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 iid from the distribution, the SeparatingKernelClassifier constructs a kernel-based classifier of the support of the distribution based on the theory of separating kernels.

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
  • kernel_fn – The kernel function used by the classifier.

  • regularization_param – The regularization parameter used in the regularized least-squares problem. 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.

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]#