Approximates feature map of the 'skewed chi-squared' kernel by Monte Carlo approximation of its Fourier transform.
Read more in the :ref:`User Guide <skewed_chi_kernel_approx>`.
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 instance or None, optional (default=None) Pseudo-random number generator to control the generation of the random weights and random offset when fitting the training data. Pass an int for reproducible output across multiple function calls. See :term:`Glossary <random_state>`.
Examples -------- >>> from sklearn.kernel_approximation import SkewedChi2Sampler >>> from sklearn.linear_model import SGDClassifier >>> X = [0, 0], [1, 1], [1, 0], [0, 1] >>> y = 0, 0, 1, 1 >>> chi2_feature = SkewedChi2Sampler(skewedness=.01, ... n_components=10, ... random_state=0) >>> X_features = chi2_feature.fit_transform(X, y) >>> clf = SGDClassifier(max_iter=10, tol=1e-3) >>> clf.fit(X_features, y) SGDClassifier(max_iter=10) >>> clf.score(X_features, y) 1.0
References ---------- See 'Random Fourier Approximations for Skewed Multiplicative Histogram Kernels' by Fuxin Li, Catalin Ionescu and Cristian Sminchisescu.
See also -------- AdditiveChi2Sampler : A different approach for approximating an additive variant of the chi squared kernel.
sklearn.metrics.pairwise.chi2_kernel : The exact chi squared kernel.