Documentation
Classes
PairwiseKernel

PairwiseKernel

Wrapper for kernels in sklearn.metrics.pairwise.

A thin wrapper around the functionality of the kernels in sklearn.metrics.pairwise.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new PairwiseKernel(opts?: object): PairwiseKernel;

Parameters

NameTypeDescription
opts?object-
opts.gamma?numberParameter gamma of the pairwise kernel specified by metric. It should be positive. Default Value 1
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. Default Value 'linear'
opts.pairwise_kernels_kwargs?anyAll 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 (opens in a new tab)

Methods

__call__()

Return the kernel k(X, Y) and optionally its gradient.

Signature

__call__(opts: object): Promise<ArrayLike[]>;

Parameters

NameTypeDescription
optsobject-
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.
opts.eval_gradient?booleanDetermines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is undefined. Default Value false

Returns

Promise<ArrayLike[]>

Defined in: generated/gaussian_process/kernels/PairwiseKernel.ts:135 (opens in a new tab)

clone_with_theta()

Returns a clone of self with given hyperparameters theta.

Signature

clone_with_theta(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.theta?ArrayLikeThe hyperparameters

Returns

Promise<any>

Defined in: generated/gaussian_process/kernels/PairwiseKernel.ts:184 (opens in a new tab)

diag()

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.

Signature

diag(opts: object): Promise<ArrayLike>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Left argument of the returned kernel k(X, Y)

Returns

Promise<ArrayLike>

Defined in: generated/gaussian_process/kernels/PairwiseKernel.ts:222 (opens in a new tab)

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/gaussian_process/kernels/PairwiseKernel.ts:118 (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

NameType
pyPythonBridge

Returns

Promise<void>

Defined in: generated/gaussian_process/kernels/PairwiseKernel.ts:74 (opens in a new tab)

is_stationary()

Returns whether the kernel is stationary.

Signature

is_stationary(opts: object): Promise<any>;

Parameters

NameType
optsobject

Returns

Promise<any>

Defined in: generated/gaussian_process/kernels/PairwiseKernel.ts:255 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/gaussian_process/kernels/PairwiseKernel.ts:21 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/gaussian_process/kernels/PairwiseKernel.ts:20 (opens in a new tab)

_py

PythonBridge

Defined in: generated/gaussian_process/kernels/PairwiseKernel.ts:19 (opens in a new tab)

id

string

Defined in: generated/gaussian_process/kernels/PairwiseKernel.ts:16 (opens in a new tab)

opts

any

Defined in: generated/gaussian_process/kernels/PairwiseKernel.ts:17 (opens in a new tab)

Accessors

hyperparameter_gamma

Signature

hyperparameter_gamma(): Promise<any>;

Returns

Promise<any>

Defined in: generated/gaussian_process/kernels/PairwiseKernel.ts:278 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/gaussian_process/kernels/PairwiseKernel.ts:61 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/gaussian_process/kernels/PairwiseKernel.ts:65 (opens in a new tab)