Class: KernelCenterer
Center an arbitrary kernel matrix \(K\).
Let define a kernel \(K\) such that:
Constructors
new KernelCenterer()
new KernelCenterer(
opts
?):KernelCenterer
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.feature_names_in_ ? | ArrayLike | Names of features seen during fit. Defined only when X has feature names that are all strings. |
opts.K_fit_all_ ? | number | Average of kernel matrix. |
opts.K_fit_rows_ ? | ArrayLike | Average of each column of kernel matrix. |
opts.n_features_in_ ? | number | Number of features seen during fit. |
Returns KernelCenterer
Defined in generated/preprocessing/KernelCenterer.ts:23
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/preprocessing/KernelCenterer.ts:21 |
_isInitialized | boolean | false | generated/preprocessing/KernelCenterer.ts:20 |
_py | PythonBridge | undefined | generated/preprocessing/KernelCenterer.ts:19 |
id | string | undefined | generated/preprocessing/KernelCenterer.ts:16 |
opts | any | undefined | generated/preprocessing/KernelCenterer.ts:17 |
Accessors
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge
):void
Parameters
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/preprocessing/KernelCenterer.ts:48
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/preprocessing/KernelCenterer.ts:100
fit()
fit(
opts
):Promise
<any
>
Fit KernelCenterer.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.K ? | ArrayLike [] | Kernel matrix. |
opts.y ? | any | Ignored. |
Returns Promise
<any
>
Defined in generated/preprocessing/KernelCenterer.ts:117
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/preprocessing/KernelCenterer.ts:156
get_feature_names_out()
get_feature_names_out(
opts
):Promise
<any
>
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
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/preprocessing/KernelCenterer.ts:200
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/preprocessing/KernelCenterer.ts:236
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/preprocessing/KernelCenterer.ts:61
set_fit_request()
set_fit_request(
opts
):Promise
<any
>
Request metadata passed to the fit
method.
Note that this method is only relevant if enable_metadata_routing=True
(see sklearn.set_config
). Please see User Guide on how the routing mechanism works.
The options for each parameter are:
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.K ? | string | boolean | Metadata routing for K parameter in fit . |
Returns Promise
<any
>
Defined in generated/preprocessing/KernelCenterer.ts:274
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/preprocessing/KernelCenterer.ts:310
set_transform_request()
set_transform_request(
opts
):Promise
<any
>
Request metadata passed to the transform
method.
Note that this method is only relevant if enable_metadata_routing=True
(see sklearn.set_config
). Please see User Guide on how the routing mechanism works.
The options for each parameter are:
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.copy ? | string | boolean | Metadata routing for copy parameter in transform . |
opts.K ? | string | boolean | Metadata routing for K parameter in transform . |
Returns Promise
<any
>
Defined in generated/preprocessing/KernelCenterer.ts:346
transform()
transform(
opts
):Promise
<ArrayLike
[]>
Center kernel matrix.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.copy ? | boolean | Set to false to perform inplace computation. |
opts.K ? | ArrayLike [] | Kernel matrix. |
Returns Promise
<ArrayLike
[]>