separating_kernel#

Separating kernel classifier.

Separating kernel classifier, useful for forward stochastic reachability analysis.

class gym_socks.algorithms.reach.separating_kernel.SeparatingKernelClassifier(kernel_fn=None, regularization_param=None, *args, **kwargs)[source]#

Separating kernel classifier.

A kernel-based support classifier for unknown distributions. Given a set of data taken i.i.d. from the distribution, the SeparatingKernelClassifier constructs a kernel-based classifier of the support of the distribution based on the theory of separating kernels.

Parameters
  • kernel_fn – The kernel function used by the algorithm.

  • regularization_param (float) – The regularization parameter \(\lambda > 0\). Determines the smoothness of the solution.

Example

>>> from gym_socks.algorithms.reach import SeparatingKernelClassifier
>>> from gym_socks.kernel.metrics import abel_kernel
>>> from functools import partial
>>> kernel_fn = partial(abel_kernel, sigma=0.1)
>>> classifier = SeparatingKernelClassifier(kernel_fn)
>>> classifier.fit(S)
>>> classifications = classifier.predict(T)
fit(X)[source]#

Fit separating kernel classifier.

Note

The sample used by the classifier is from the marginal distribution, not the joint or conditional. Thus, the data should be an array of points organized such that each point occupies a single row in a 2D-array.

Parameters

X (numpy.ndarray) – Data drawn from distribution.

Returns

Instance of SeparatingKernelClassifier

Return type

self

predict(T)[source]#

Predict using the separating kernel classifier.

Parameters

T (numpy.ndarray) – Evaluation points where the separating kernel classifier is evaluated.

Returns

Boolean indicator of classifier.

Return type

list

score()[source]#