This documentation is for scikit-learn version 0.10Other versions

Citing

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

This page

8.12.3. sklearn.kernel_approximation.SkewedChi2Sampler

class sklearn.kernel_approximation.SkewedChi2Sampler(skewedness=1.0, n_components=100, random_state=None)

Approximates feature map of the “skewed chi-squared” kernel by Monte Carlo approximation of its Fourier transform.

Parameters :

skewedness: float :

“skewedness” parameter of the kernel. Needs to be cross-validated.

n_components: int :

number of Monte Carlo samples per original feature. Equals the dimensionality of the computed feature space.

random_state : {int, RandomState}, optional

If int, random_state is the seed used by the random number generator; if RandomState instance, random_state is the random number generator.

Notes

See “Random Fourier Approximations for Skewed Multiplicative Histogram Kernels” by Fuxin Li, Catalin Ionescu and Cristian Sminchisescu.

Methods

fit(X[, y]) Fit the model with X.
fit_transform(X[, y]) Fit to data, then transform it
set_params(**params) Set the parameters of the estimator.
transform(X[, y]) Apply the approximate feature map to X.
__init__(skewedness=1.0, n_components=100, random_state=None)
fit(X, y=None)

Fit the model with X.

Samples random projection according to n_features.

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 : object

Returns the transformer.

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 the approximate feature map to X.

Parameters :

X: array-like, shape (n_samples, n_features) :

New data, where n_samples in the number of samples and n_features is the number of features.

Returns :

X_new: array-like, shape (n_samples, n_components) :