Documentation
Classes
RBFSampler

RBFSampler

Approximate a RBF kernel feature map using random Fourier features.

It implements a variant of Random Kitchen Sinks.[1]

Read more in the User Guide.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new RBFSampler(opts?: object): RBFSampler;

Parameters

NameTypeDescription
opts?object-
opts.gamma?number | "scale"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. Default Value 1
opts.n_components?numberNumber of Monte Carlo samples per original feature. Equals the dimensionality of the computed feature space. Default Value 100
opts.random_state?numberPseudo-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.

Returns

RBFSampler

Defined in: generated/kernel_approximation/RBFSampler.ts:25 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/kernel_approximation/RBFSampler.ts:23 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/kernel_approximation/RBFSampler.ts:22 (opens in a new tab)

_py

PythonBridge

Defined in: generated/kernel_approximation/RBFSampler.ts:21 (opens in a new tab)

id

string

Defined in: generated/kernel_approximation/RBFSampler.ts:18 (opens in a new tab)

opts

any

Defined in: generated/kernel_approximation/RBFSampler.ts:19 (opens in a new tab)

Accessors

feature_names_in_

Names of features seen during fit. Defined only when X has feature names that are all strings.

Signature

feature_names_in_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/kernel_approximation/RBFSampler.ts:391 (opens in a new tab)

n_features_in_

Number of features seen during fit.

Signature

n_features_in_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/kernel_approximation/RBFSampler.ts:366 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/kernel_approximation/RBFSampler.ts:49 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/kernel_approximation/RBFSampler.ts:53 (opens in a new tab)

random_offset_

Random offset used to compute the projection in the n\_components dimensions of the feature space.

Signature

random_offset_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/kernel_approximation/RBFSampler.ts:316 (opens in a new tab)

random_weights_

Random projection directions drawn from the Fourier transform of the RBF kernel.

Signature

random_weights_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/kernel_approximation/RBFSampler.ts:341 (opens in a new tab)

Methods

dispose()

Disposes of the underlying Python resources.

Once dispose() is called, the instance is no longer usable.

Signature

dispose(): Promise<void>;

Returns

Promise<void>

Defined in: generated/kernel_approximation/RBFSampler.ts:104 (opens in a new tab)

fit()

Fit the model with X.

Samples random projection according to n_features.

Signature

fit(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.X?anyTraining data, where n\_samples is the number of samples and n\_features is the number of features.
opts.y?ArrayLikeTarget values (undefined for unsupervised transformations).

Returns

Promise<any>

Defined in: generated/kernel_approximation/RBFSampler.ts:123 (opens in a new tab)

fit_transform()

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit\_params and returns a transformed version of X.

Signature

fit_transform(opts: object): Promise<any[]>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Input samples.
opts.fit_params?anyAdditional fit parameters.
opts.y?ArrayLikeTarget values (undefined for unsupervised transformations).

Returns

Promise<any[]>

Defined in: generated/kernel_approximation/RBFSampler.ts:163 (opens in a new tab)

get_feature_names_out()

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"\].

Signature

get_feature_names_out(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.input_features?anyOnly used to validate feature names with the names seen in fit.

Returns

Promise<any>

Defined in: generated/kernel_approximation/RBFSampler.ts:212 (opens in a new tab)

init()

Initializes the underlying Python resources.

This instance is not usable until the Promise returned by init() resolves.

Signature

init(py: PythonBridge): Promise<void>;

Parameters

NameType
pyPythonBridge

Returns

Promise<void>

Defined in: generated/kernel_approximation/RBFSampler.ts:62 (opens in a new tab)

set_output()

Set output container.

See Introducing the set_output API for an example on how to use the API.

Signature

set_output(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.transform?"default" | "pandas"Configure output of transform and fit\_transform.

Returns

Promise<any>

Defined in: generated/kernel_approximation/RBFSampler.ts:250 (opens in a new tab)

transform()

Apply the approximate feature map to X.

Signature

transform(opts: object): Promise<ArrayLike>;

Parameters

NameTypeDescription
optsobject-
opts.X?anyNew data, where n\_samples is the number of samples and n\_features is the number of features.

Returns

Promise<ArrayLike>

Defined in: generated/kernel_approximation/RBFSampler.ts:283 (opens in a new tab)