Documentation
Classes
AdditiveChi2Sampler

AdditiveChi2Sampler

Approximate feature map for additive chi2 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 sample_steps 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.

Read more in the User Guide.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new AdditiveChi2Sampler(opts?: object): AdditiveChi2Sampler;

Parameters

NameTypeDescription
opts?object-
opts.sample_interval?numberSampling interval. Must be specified when sample_steps not in {1,2,3}.
opts.sample_steps?numberGives the number of (complex) sampling points. Default Value 2

Returns

AdditiveChi2Sampler

Defined in: generated/kernel_approximation/AdditiveChi2Sampler.ts:29 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/kernel_approximation/AdditiveChi2Sampler.ts:27 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/kernel_approximation/AdditiveChi2Sampler.ts:26 (opens in a new tab)

_py

PythonBridge

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

id

string

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

opts

any

Defined in: generated/kernel_approximation/AdditiveChi2Sampler.ts:23 (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/AdditiveChi2Sampler.ts:379 (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/AdditiveChi2Sampler.ts:352 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/kernel_approximation/AdditiveChi2Sampler.ts:46 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/kernel_approximation/AdditiveChi2Sampler.ts:50 (opens in a new tab)

sample_interval_

Stored sampling interval. Specified as a parameter if sample\_steps not in {1,2,3}.

Signature

sample_interval_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/kernel_approximation/AdditiveChi2Sampler.ts:325 (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/AdditiveChi2Sampler.ts:103 (opens in a new tab)

fit()

Set the parameters.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeTraining 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/AdditiveChi2Sampler.ts:120 (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/AdditiveChi2Sampler.ts:162 (opens in a new tab)

get_feature_names_out()

Get output feature names for transformation.

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/AdditiveChi2Sampler.ts:213 (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/AdditiveChi2Sampler.ts:59 (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/AdditiveChi2Sampler.ts:253 (opens in a new tab)

transform()

Apply approximate feature map to X.

Signature

transform(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.

Returns

Promise<any>

Defined in: generated/kernel_approximation/AdditiveChi2Sampler.ts:290 (opens in a new tab)