Nystroem
Approximate a kernel map using a subset of the training data.
Constructs an approximate feature map for an arbitrary kernel using a subset of the data as basis.
Read more in the User Guide.
Python Reference (opens in a new tab)
Constructors
constructor()
Signature
new Nystroem(opts?: object): Nystroem;
Parameters
Name | Type | Description |
---|---|---|
opts? | object | - |
opts.coef0? | number | Zero coefficient for polynomial and sigmoid kernels. Ignored by other kernels. |
opts.degree? | number | Degree of the polynomial kernel. Ignored by other kernels. |
opts.gamma? | number | Gamma parameter for the RBF, laplacian, polynomial, exponential chi2 and sigmoid kernels. Interpretation of the default value is left to the kernel; see the documentation for sklearn.metrics.pairwise. Ignored by other kernels. |
opts.kernel? | string | Kernel map to be approximated. A callable should accept two arguments and the keyword arguments passed to this object as kernel\_params , and should return a floating point number. Default Value 'rbf' |
opts.kernel_params? | any | Additional parameters (keyword arguments) for kernel function passed as callable object. |
opts.n_components? | number | Number of features to construct. How many data points will be used to construct the mapping. Default Value 100 |
opts.n_jobs? | number | The number of jobs to use for the computation. This works by breaking down the kernel matrix into n\_jobs even slices and computing them in parallel. undefined means 1 unless in a joblib.parallel\_backend (opens in a new tab) context. \-1 means using all processors. See Glossary for more details. |
opts.random_state? | number | Pseudo-random number generator to control the uniform sampling without replacement of n\_components of the training data to construct the basis kernel. Pass an int for reproducible output across multiple function calls. See Glossary. |
Returns
Defined in: generated/kernel_approximation/Nystroem.ts:25 (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/Nystroem.ts:136 (opens in a new tab)
fit()
Fit estimator to data.
Samples a subset of training points, computes kernel on these and computes normalization matrix.
Signature
fit(opts: object): Promise<any>;
Parameters
Name | 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/Nystroem.ts:155 (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
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike [] | Input samples. |
opts.fit_params? | any | Additional fit parameters. |
opts.y? | ArrayLike | Target values (undefined for unsupervised transformations). |
Returns
Promise
<any
[]>
Defined in: generated/kernel_approximation/Nystroem.ts:195 (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
Name | 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/Nystroem.ts:244 (opens in a new tab)
get_metadata_routing()
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
Signature
get_metadata_routing(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.routing? | any | A MetadataRequest encapsulating routing information. |
Returns
Promise
<any
>
Defined in: generated/kernel_approximation/Nystroem.ts:281 (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
Name | Type |
---|---|
py | PythonBridge |
Returns
Promise
<void
>
Defined in: generated/kernel_approximation/Nystroem.ts:89 (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
Name | Type | Description |
---|---|---|
opts | object | - |
opts.transform? | "default" | "pandas" | Configure output of transform and fit\_transform . |
Returns
Promise
<any
>
Defined in: generated/kernel_approximation/Nystroem.ts:316 (opens in a new tab)
transform()
Apply feature map to X.
Computes an approximate feature map using the kernel between some training points and X.
Signature
transform(opts: object): Promise<ArrayLike[]>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike [] | Data to transform. |
Returns
Promise
<ArrayLike
[]>
Defined in: generated/kernel_approximation/Nystroem.ts:351 (opens in a new tab)
Properties
_isDisposed
boolean
=false
Defined in: generated/kernel_approximation/Nystroem.ts:23 (opens in a new tab)
_isInitialized
boolean
=false
Defined in: generated/kernel_approximation/Nystroem.ts:22 (opens in a new tab)
_py
PythonBridge
Defined in: generated/kernel_approximation/Nystroem.ts:21 (opens in a new tab)
id
string
Defined in: generated/kernel_approximation/Nystroem.ts:18 (opens in a new tab)
opts
any
Defined in: generated/kernel_approximation/Nystroem.ts:19 (opens in a new tab)
Accessors
component_indices_
Indices of components\_
in the training set.
Signature
component_indices_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/kernel_approximation/Nystroem.ts:407 (opens in a new tab)
components_
Subset of training points used to construct the feature map.
Signature
components_(): Promise<ArrayLike[]>;
Returns
Promise
<ArrayLike
[]>
Defined in: generated/kernel_approximation/Nystroem.ts:384 (opens in a new tab)
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/Nystroem.ts:482 (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/Nystroem.ts:457 (opens in a new tab)
normalization_
Normalization matrix needed for embedding. Square root of the kernel matrix on components\_
.
Signature
normalization_(): Promise<ArrayLike[]>;
Returns
Promise
<ArrayLike
[]>
Defined in: generated/kernel_approximation/Nystroem.ts:432 (opens in a new tab)
py
Signature
py(): PythonBridge;
Returns
PythonBridge
Defined in: generated/kernel_approximation/Nystroem.ts:76 (opens in a new tab)
Signature
py(pythonBridge: PythonBridge): void;
Parameters
Name | Type |
---|---|
pythonBridge | PythonBridge |
Returns
void
Defined in: generated/kernel_approximation/Nystroem.ts:80 (opens in a new tab)