pykoop.KernelApproximation
- class KernelApproximation
Bases:
BaseEstimator
,TransformerMixin
Base class for all kernel approximations.
All attributes with a trailing underscore must be set in the subclass’
fit()
.- n_features_out_
Number of features output. This attribute is not available in estimators from
sklearn.kernel_approximation
.- Type:
- __init__()
Methods
__init__
()fit
(X[, y])Fit kernel approximation.
fit_transform
(X[, y])Fit to data, then transform it.
Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
set_output
(*[, transform])Set output container.
set_params
(**params)Set the parameters of this estimator.
transform
(X)Transform data.
- abstract fit(X, y=None)
Fit kernel approximation.
- Parameters:
X (np.ndarray) – Data matrix.
y (Optional[np.ndarray]) – Ignored.
- Returns:
Instance of itself.
- Return type:
- Raises:
ValueError – If any of the constructor parameters are incorrect.
- fit_transform(X, y=None, **fit_params)
Fit to data, then transform it.
Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.
- Parameters:
X (array-like of shape (n_samples, n_features)) – Input samples.
y (array-like of shape (n_samples,) or (n_samples, n_outputs), default=None) – Target values (None for unsupervised transformations).
**fit_params (dict) – Additional fit parameters.
- Returns:
X_new – Transformed array.
- Return type:
ndarray array of shape (n_samples, n_features_new)
- get_metadata_routing()
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
routing – A
MetadataRequest
encapsulating routing information.- Return type:
MetadataRequest
- get_params(deep=True)
Get parameters for this estimator.
- set_output(*, transform=None)
Set output container.
See Introducing the set_output API for an example on how to use the API.
- Parameters:
transform ({"default", "pandas"}, default=None) –
Configure output of transform and fit_transform.
”default”: Default output format of a transformer
”pandas”: DataFrame output
”polars”: Polars output
None: Transform configuration is unchanged
Added in version 1.4: “polars” option was added.
- Returns:
self – Estimator instance.
- Return type:
estimator instance
- set_params(**params)
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline
). The latter have parameters of the form<component>__<parameter>
so that it’s possible to update each component of a nested object.- Parameters:
**params (dict) – Estimator parameters.
- Returns:
self – Estimator instance.
- Return type:
estimator instance
- abstract transform(X)
Transform data.
- Parameters:
X (np.ndarray) – Data matrix.
- Returns:
Transformed data matrix.
- Return type:
np.ndarray