fit_regselect_discrete()

fit_regselect_discrete()#

ROM.fit_regselect_discrete(candidates: list, states: list, inputs: list = None, fit_transformer: bool = True, fit_basis: bool = True, regularizer_factory=None, gridsearch_only: bool = False, num_test_iters: int = 0, stability_margin: float = 5.0, test_cases: list = None, verbose: bool = False)[source]#

Calibrate the fully discrete model to training data, selecting the regularization hyperparameter(s) that minimize the training error while maintaining stability over the testing regime.

This method requires the model to be time-continuous and to have a solver of one of the following types:

The solver.regularizer is repeatedly adjusted, and the model is recalibrated, until a best regularization is selected.

candidateslist of regularization hyperparameters

Regularization hyperparameters to check. If a single hyperparameter is given, use it as the start of an optimization-based search.

stateslist of s (n, k_i) ndarrays

State snapshots in the original state space. Each array states[i] is data corresponding to a different trajectory; each column states[i][:, j] is one snapshot. This method assumes the snapshots are sequential, i.e., the model maps states[i][:, j] to states[i][:, j+1].

stateslist of s (r, k_i) ndarrays

State snapshots in the reduced state space. This method assumes the snapshots are sequential, i.e., the model maps states[i][:, j] to states[i][:, j+1].

inputslist of s (m, k_i + num_test_iters) ndarrays

Inputs corresponding to the training data, together with inputs for the testing regime. Only required if the model takes external inputs.

regularizer_factorycallable or None

Function mapping regularization hyperparameters to the full regularizer. Specifically, regularizer_factory(candidates[i]) will be assigned to model.solver.regularizer for each i.

gridsearch_onlybool

If True, stop after checking all regularization candidates and do not follow up with optimization.

num_test_itersint

Number of iterations after the training data in which to require model stability.

stability_marginfloat,

Factor by which the reduced states may deviate from the range of the training data without being flagged as unstable.

test_caseslist of DiscreteRegTest objects

Additional test cases for which the model is required to be stable. See opinf.utils.DiscreteRegTest.

verbosebool

If True, print information during the regularization selection.

Notes

If there is only one trajectory of training data (s = 1), states may be provided as an (n, k) ndarray. In this case, it is assumed that inputs (if provided) is a single (m, k) ndarray.