Class: PairwiseKernel
Wrapper for kernels in sklearn.metrics.pairwise.
A thin wrapper around the functionality of the kernels in sklearn.metrics.pairwise.
Constructors
new PairwiseKernel()
new PairwiseKernel(
opts
?):PairwiseKernel
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.gamma ? | number | Parameter gamma of the pairwise kernel specified by metric. It should be positive. |
opts.gamma_bounds ? | "fixed" | The lower and upper bound on ‘gamma’. If set to “fixed”, ‘gamma’ cannot be changed during hyperparameter tuning. |
opts.metric ? | "sigmoid" | "linear" | "poly" | "rbf" | "cosine" | "additive_chi2" | "chi2" | "polynomial" | "laplacian" | The metric to use when calculating kernel between instances in a feature array. If metric is a string, it must be one of the metrics in pairwise.PAIRWISE_KERNEL_FUNCTIONS. If metric is “precomputed”, X is assumed to be a kernel matrix. Alternatively, if metric is a callable function, it is called on each pair of instances (rows) and the resulting value recorded. The callable should take two arrays from X as input and return a value indicating the distance between them. |
opts.pairwise_kernels_kwargs ? | any | All entries of this dict (if any) are passed as keyword arguments to the pairwise kernel function. |
Returns PairwiseKernel
Defined in generated/gaussian_process/kernels/PairwiseKernel.ts:23
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/gaussian_process/kernels/PairwiseKernel.ts:21 |
_isInitialized | boolean | false | generated/gaussian_process/kernels/PairwiseKernel.ts:20 |
_py | PythonBridge | undefined | generated/gaussian_process/kernels/PairwiseKernel.ts:19 |
id | string | undefined | generated/gaussian_process/kernels/PairwiseKernel.ts:16 |
opts | any | undefined | generated/gaussian_process/kernels/PairwiseKernel.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/gaussian_process/kernels/PairwiseKernel.ts:61
Methods
__call__()
__call__(
opts
):Promise
<ArrayLike
[]>
Return the kernel k(X, Y) and optionally its gradient.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.eval_gradient ? | boolean | Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is undefined . |
opts.X ? | ArrayLike [] | Left argument of the returned kernel k(X, Y) |
opts.Y ? | ArrayLike [] | Right argument of the returned kernel k(X, Y). If undefined , k(X, X) if evaluated instead. |
Returns Promise
<ArrayLike
[]>
Defined in generated/gaussian_process/kernels/PairwiseKernel.ts:130
clone_with_theta()
clone_with_theta(
opts
):Promise
<any
>
Returns a clone of self with given hyperparameters theta.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.theta ? | ArrayLike | The hyperparameters |
Returns Promise
<any
>
Defined in generated/gaussian_process/kernels/PairwiseKernel.ts:174
diag()
diag(
opts
):Promise
<ArrayLike
>
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | ArrayLike [] | Left argument of the returned kernel k(X, Y) |
Returns Promise
<ArrayLike
>
Defined in generated/gaussian_process/kernels/PairwiseKernel.ts:210
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/gaussian_process/kernels/PairwiseKernel.ts:113
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/gaussian_process/kernels/PairwiseKernel.ts:74
is_stationary()
is_stationary(
opts
):Promise
<any
>
Returns whether the kernel is stationary.
Parameters
Parameter | Type |
---|---|
opts | object |
Returns Promise
<any
>
Defined in generated/gaussian_process/kernels/PairwiseKernel.ts:242