Parameter of RBF kernel: exp(-gamma * x^2).
If gamma='scale' is passed then it uses
1 / (n_features * X.var()) as value of gamma.
n_components : int, default=100
Number of Monte Carlo samples per original feature.
Equals the dimensionality of the computed feature space.
random_state : int, RandomState instance or None, 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 Glossary.
Attributes:
random_offset_ : ndarray of shape (n_components,), dtype={np.float64, np.float32}
Random offset used to compute the projection in the n_components
dimensions of the feature space.
random_weights_ : ndarray of shape (n_features, n_components), dtype={np.float64, np.float32}
Random projection directions drawn from the Fourier transform
of the RBF kernel.
Samples random projection according to n_features.
Parameters:
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training data, where n_samples is the number of samples
and n_features is the number of features.
y : array-like, shape (n_samples,) or (n_samples, n_outputs), default=None
Target values (None for unsupervised transformations).
Returns:
self : object
Returns the instance itself.
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.
Pass only if the estimator accepts additional params in its fit method.
Returns:
X_new : ndarray array of shape (n_samples, n_features_new)
Transformed array.
get_feature_names_out(input_features=None)
Get output feature names for transformation.
The feature names out will prefixed by the lowercased class name. For
example, if the transformer outputs 3 features, then the feature names
out are: ["class_name0","class_name1","class_name2"].
Parameters:
input_features : array-like of str or None, default=None
Only used to validate feature names with the names seen in fit.
Returns:
feature_names_out : ndarray of str objects
Transformed feature names.
get_metadata_routing()
Get metadata routing of this object.
Please check User Guide on how the routing
mechanism works.
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
Estimator instance.
transform(X)
Apply the approximate feature map to X.
Parameters:
X : {array-like, sparse matrix}, shape (n_samples, n_features)
New data, where n_samples is the number of samples
and n_features is the number of features.