pyrfm.random_feature.AdditiveChi2Sampler¶
-
class
pyrfm.random_feature.
AdditiveChi2Sampler
(sample_steps=2, sample_interval=None)[source]¶ Bases:
sklearn.kernel_approximation.AdditiveChi2Sampler
A wrapper of sklearn.kernel_approximation.AdditiveChi2Sampler.
- Parameters
sample_steps (int, optional) – Gives the number of (complex) sampling points.
sample_interval (float, optional) – Sampling interval. Must be specified when sample_steps not in {1,2,3}.
References
See “Efficient additive kernels via explicit feature maps” A. Vedaldi and A. Zisserman. Pattern Analysis and Machine Intelligence, 2011.
-
fit
(X, y=None)[source]¶ Set the parameters
- Parameters
X (array-like, shape (n_samples, n_features)) – Training data, where n_samples in the number of samples and n_features is the number of features.
- Returns
self – Returns the transformer.
- Return type
object
-
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 (numpy array of shape [n_samples, n_features]) – Training set.
y (numpy array of shape [n_samples]) – Target values.
- Returns
X_new – Transformed array.
- Return type
numpy array of shape [n_samples, n_features_new]
-
get_params
(deep=True)¶ Get parameters for this estimator.
- Parameters
deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns
params – Parameter names mapped to their values.
- Return type
mapping of string to any
-
set_params
(**params)¶ Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each component of a nested object.- Returns
- Return type
self
-
transform
(X)[source]¶ Apply approximate feature map to X.
- Parameters
X ({array-like, sparse matrix}, shape = (n_samples, n_features)) –
- Returns
X_new – Whether the return value is an array of sparse matrix depends on the type of the input X.
- Return type
{array, sparse matrix}, shape = (n_samples, n_features * (2*sample_steps + 1))