This documentation is for scikit-learn version 0.11-gitOther versions

Citing

If you use the software, please consider citing scikit-learn.

This page

8.12.2. sklearn.kernel_approximation.AdditiveChi2Sampler

class sklearn.kernel_approximation.AdditiveChi2Sampler(sample_steps=2, sample_interval=None)

Approximate feature map for additive chi² kernel.

Uses sampling the fourier transform of the kernel characteristic at regular intervals.

Since the kernel that is to be approximated is additive, the components of the input vectors can be treated separately. Each entry in the original space is transformed into 2×sample_steps+1 features, where sample_steps is a parameter of the method. Typical values of n include 1, 2 and 3.

Optimal choices for the sampling interval for certain data ranges can be computed (see the reference). The default values should be reasonable.

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}.

Notes

See “Efficient additive kernels via explicit feature maps” Vedaldi, A. and Zisserman, A. - Computer Vision and Pattern Recognition 2010

Methods

fit(X[, y]) Set parameters.
fit_transform(X[, y]) Fit to data, then transform it
set_params(**params) Set the parameters of the estimator.
transform(X[, y]) Apply approximate feature map to X.
__init__(sample_steps=2, sample_interval=None)
fit(X, y=None)

Set parameters.

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 : numpy array of shape [n_samples, n_features_new]

Transformed array.

Notes

This method just calls fit and transform consecutively, i.e., it is not an optimized implementation of fit_transform, unlike other transformers such as PCA.

set_params(**params)

Set the parameters of the estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The former have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns :self :
transform(X, y=None)

Apply approximate feature map to X.

Parameters :X: array-like, shape (n_samples, n_features) :
Returns :X_new: array-like, shape (n_samples, n_features * (2n + 1)) :