Class: 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.
Constructors
new AdditiveChi2Sampler()
new AdditiveChi2Sampler(
opts
?):AdditiveChi2Sampler
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.sample_interval ? | number | Sampling interval. Must be specified when sample_steps not in {1,2,3}. |
opts.sample_steps ? | number | Gives the number of (complex) sampling points. |
Returns AdditiveChi2Sampler
Defined in generated/kernel_approximation/AdditiveChi2Sampler.ts:29
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/kernel_approximation/AdditiveChi2Sampler.ts:27 |
_isInitialized | boolean | false | generated/kernel_approximation/AdditiveChi2Sampler.ts:26 |
_py | PythonBridge | undefined | generated/kernel_approximation/AdditiveChi2Sampler.ts:25 |
id | string | undefined | generated/kernel_approximation/AdditiveChi2Sampler.ts:22 |
opts | any | undefined | generated/kernel_approximation/AdditiveChi2Sampler.ts:23 |
Accessors
feature_names_in_
Get Signature
get feature_names_in_():
Promise
<ArrayLike
>
Names of features seen during fit. Defined only when X
has feature names that are all strings.
Returns Promise
<ArrayLike
>
Defined in generated/kernel_approximation/AdditiveChi2Sampler.ts:381
n_features_in_
Get Signature
get n_features_in_():
Promise
<number
>
Number of features seen during fit.
Returns Promise
<number
>
Defined in generated/kernel_approximation/AdditiveChi2Sampler.ts:354
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge
):void
Parameters
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/kernel_approximation/AdditiveChi2Sampler.ts:46
Methods
dispose()
dispose():
Promise
<void
>
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
Returns Promise
<void
>
Defined in generated/kernel_approximation/AdditiveChi2Sampler.ts:102
fit()
fit(
opts
):Promise
<any
>
Only validates estimator’s parameters.
This method allows to: (i) validate the estimator’s parameters and (ii) be consistent with the scikit-learn transformer API.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | ArrayLike | Training data, where n_samples is the number of samples and n_features is the number of features. |
opts.y ? | ArrayLike | Target values (undefined for unsupervised transformations). |
Returns Promise
<any
>
Defined in generated/kernel_approximation/AdditiveChi2Sampler.ts:121
fit_transform()
fit_transform(
opts
):Promise
<any
[]>
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
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.fit_params ? | any | Additional fit parameters. |
opts.X ? | ArrayLike [] | Input samples. |
opts.y ? | ArrayLike | Target values (undefined for unsupervised transformations). |
Returns Promise
<any
[]>
Defined in generated/kernel_approximation/AdditiveChi2Sampler.ts:162
get_feature_names_out()
get_feature_names_out(
opts
):Promise
<any
>
Get output feature names for transformation.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.input_features ? | any | Only used to validate feature names with the names seen in fit . |
Returns Promise
<any
>
Defined in generated/kernel_approximation/AdditiveChi2Sampler.ts:208
get_metadata_routing()
get_metadata_routing(
opts
):Promise
<any
>
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.routing ? | any | A MetadataRequest encapsulating routing information. |
Returns Promise
<any
>
Defined in generated/kernel_approximation/AdditiveChi2Sampler.ts:246
init()
init(
py
):Promise
<void
>
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
Parameters
Parameter | Type |
---|---|
py | PythonBridge |
Returns Promise
<void
>
Defined in generated/kernel_approximation/AdditiveChi2Sampler.ts:59
set_output()
set_output(
opts
):Promise
<any
>
Set output container.
See Introducing the set_output API for an example on how to use the API.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.transform ? | "default" | "pandas" | "polars" | Configure output of transform and fit_transform . |
Returns Promise
<any
>
Defined in generated/kernel_approximation/AdditiveChi2Sampler.ts:284
transform()
transform(
opts
):Promise
<any
>
Apply approximate feature map to X.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | any | Training 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:320