Polynomial kernel approximation via Tensor Sketch.
Implements Tensor Sketch, which approximates the feature map of the polynomial kernel:
new PolynomialCountSketch(opts?: object): PolynomialCountSketch;
Name | Type | Description |
---|---|---|
opts? |
object |
- |
opts.coef0? |
number |
Constant term of the polynomial kernel whose feature map will be approximated. Default Value 0 |
opts.degree? |
number |
Degree of the polynomial kernel whose feature map will be approximated. Default Value 2 |
opts.gamma? |
number |
Parameter of the polynomial kernel whose feature map will be approximated. Default Value 1 |
opts.n_components? |
number |
Dimensionality of the output feature space. Usually, n\_components should be greater than the number of features in input samples in order to achieve good performance. The optimal score / run time balance is typically achieved around n\_components = 10 * n\_features , but this depends on the specific dataset being used. Default Value 100 |
opts.random_state? |
number |
Determines random number generation for indexHash and bitHash initialization. Pass an int for reproducible results across multiple function calls. See Glossary. |
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:23
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
dispose(): Promise<void>;
Promise
<void
>
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:122
Fit the model with X.
Initializes the internal variables. The method needs no information about the distribution of data, so we only care about n_features in X.
fit(opts: object): Promise<any>;
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). |
Promise
<any
>
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:141
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit\_params
and returns a transformed version of X
.
fit_transform(opts: object): Promise<any[]>;
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). |
Promise
<any
[]>
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:185
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"\]
.
get_feature_names_out(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.input_features? |
any |
Only used to validate feature names with the names seen in fit . |
Promise
<any
>
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:239
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
get_metadata_routing(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.routing? |
any |
A MetadataRequest encapsulating routing information. |
Promise
<any
>
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:279
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
init(py: PythonBridge): Promise<void>;
Name | Type |
---|---|
py |
PythonBridge |
Promise
<void
>
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:74
Set output container.
See Introducing the set_output API for an example on how to use the API.
set_output(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.transform? |
"default" | "pandas" |
Configure output of transform and fit\_transform . |
Promise
<any
>
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:319
Generate the feature map approximation for X.
transform(opts: object): Promise<ArrayLike>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike |
New data, where n\_samples is the number of samples and n\_features is the number of features. |
Promise
<ArrayLike
>
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:356
boolean
=false
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:21
boolean
=false
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:20
PythonBridge
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:19
string
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:16
any
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:17
Array with random entries in {+1, -1}, used to represent the 2-wise independent hash functions for Count Sketch computation.
bitHash_(): Promise<ArrayLike[]>;
Promise
<ArrayLike
[]>
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:420
Names of features seen during fit. Defined only when X
has feature names that are all strings.
feature_names_in_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:474
Array of indexes in range [0, n_components) used to represent the 2-wise independent hash functions for Count Sketch computation.
indexHash_(): Promise<ArrayLike[]>;
Promise
<ArrayLike
[]>
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:393
Number of features seen during fit.
n_features_in_(): Promise<number>;
Promise
<number
>
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:447
py(): PythonBridge;
PythonBridge
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:61
py(pythonBridge: PythonBridge): void;
Name | Type |
---|---|
pythonBridge |
PythonBridge |
void
Defined in: generated/kernel_approximation/PolynomialCountSketch.ts:65