kernel_sr#
Kernel-based stochastic reachability.
Stochastic reachability seeks to compute the likelihood that a system will satisfy pre-specified safety constraints.
- class gym_socks.algorithms.reach.kernel_sr.KernelSR(time_horizon=None, constraint_tube=None, target_tube=None, problem='THT', kernel_fn=None, regularization_param=None, batch_size=None, verbose=False, *args, **kwargs)[source]#
Stochastic reachability using kernel distribution embeddings.
Computes an approximation of the safety probabilities of the stochastic reachability problem using kernel methods.
- Parameters
time_horizon (int) – Number of time steps to compute the approximation.
constraint_tube (list) – List of spaces or constraint functions. Must be the same length as time_horizon.
target_tube (list) – List of spaces or target functions. Must be the same length as time_horizon.
problem (str) – One of {“THT”, “FHT”}. “THT” specifies the terminal-hitting time problem and “FHT” specifies the first-hitting time problem.
kernel_fn – Kernel function used by the approximation.
regularization_param (float) – Regularization parameter used in the solution to the regularized least-squares problem.
batch_size (int) – The batch size for more memory-efficient computations. Omit this parameter or set to None to compute without batch processing.
verbose (bool) – Boolean flag to indicate verbose output.
- fit(S)[source]#
Run the algorithm.
- Parameters
S (numpy.ndarray) – Sample of (x, u, y) tuples taken iid from the system evolution. The sample should be in the form of a list of tuples.
- Returns
Instance of KernelSR class.
- Return type
self
- predict(T)[source]#
Predict.
- Parameters
T (numpy.ndarray) – Evaluation points to evaluate the safety probabilities at. Should be in the form of a 2D-array, where each row indicates a point.
- Returns
An array of safety probabilities of shape {len(T), time_horizon}, where each row indicates the safety probabilities of the evaluation points at a different time step.
- Return type
numpy.ndarray
- gym_socks.algorithms.reach.kernel_sr.kernel_sr(S, T, time_horizon=None, constraint_tube=None, target_tube=None, problem='THT', regularization_param=None, kernel_fn=None, batch_size=None, verbose=False)[source]#
Stochastic reachability using kernel distribution embeddings.
Computes an approximation of the safety probabilities of the stochastic reachability problem using kernel methods.
- Parameters
S (numpy.ndarray) – Sample of (x, u, y) tuples taken iid from the system evolution. The sample should be in the form of a list of tuples.
T (numpy.ndarray) – Evaluation points to evaluate the safety probabilities at. Should be in the form of a 2D-array, where each row indicates a point.
time_horizon (Optional[int]) – Number of time steps to compute the approximation.
constraint_tube (Optional[list]) – List of spaces or constraint functions. Must be the same length as time_horizon.
target_tube (Optional[list]) – List of spaces or target functions. Must be the same length as time_horizon.
problem (str) – One of {“THT”, “FHT”}. “THT” specifies the terminal-hitting time problem and “FHT” specifies the first-hitting time problem.
kernel_fn – Kernel function used by the approximation.
regularization_param (Optional[float]) – Regularization parameter used in the solution to the regularized least-squares problem.
batch_size (Optional[int]) – The batch size for more memory-efficient computations. Omit this parameter or set to None to compute without batch processing.
verbose (bool) – Boolean flag to indicate verbose output.
- Returns
An array of safety probabilities of shape {len(T), time_horizon}, where each row indicates the safety probabilities of the evaluation points at a different time step.
- Return type
numpy.ndarray
- TO20
Adam J. Thorpe and Meeko M. K. Oishi. Model-free stochastic reachability using kernel distribution embeddings. IEEE Control Systems Letters, 4(2):512–517, 2020. doi:10.1109/LCSYS.2019.2954102.
@article{thorpe2020model,
author = {Thorpe, Adam J. and Oishi, Meeko M. K.},
journal = {IEEE Control Systems Letters},
title = {Model-Free Stochastic Reachability Using Kernel Distribution Embeddings},
year = {2020},
volume = {4},
number = {2},
pages = {512-517},
doi = {10.1109/LCSYS.2019.2954102}
}