fit_regselect_continuous()

fit_regselect_continuous()#

ParametricROM.fit_regselect_continuous(candidates: list, train_time_domains: ndarray, parameters: list, states: list, ddts: list = None, input_functions: list = None, fit_transformer: bool = True, fit_basis: bool = True, regularizer_factory=None, gridsearch_only: bool = False, test_time_length: float = 0, stability_margin: float = 5.0, test_cases: list = None, verbose: bool = False, **predict_options: dict)#

Calibrate the time-continuous 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.

Parameters:
candidateslist of regularization hyperparameters

Regularization hyperparameters to check before carrying out a derivative-free optimization.

train_time_domainslist of s (k_i,) ndarrays

Time domain corresponding to the training states.

parameterslist of s (floats or (p,) ndarrays)

Parameter values for which training data are available.

stateslist of s (n, k_i) ndarrays

State snapshots in the original state space. Each array states[i] is the data corresponding to parameter value parameters[i]; each column states[i][:, j] is one snapshot.

ddtslist of s (n, k_i) ndarrays or None

Snapshot time derivative data. Each array ddts[i] are the time derivatives of states[i]; each column ddts[i][:, j] corresponds to the snapshot states[i][:, j]. If None (default), these are estimated using ddt_estimator.

input_functionslist of s callables or None

Input functions mapping time to input vectors. Only required if the model takes external inputs. Each input_functions[i] is the function corresponding to states[i], and input_functions[i](train_time_domains[i][j]) is the input vector corresponding to the snapshot states[i][:, j].

fit_transformerbool

If True (default), calibrate the preprocessing transformation using the states. If False, assume the transformer is already calibrated.

fit_basisbool

If True (default), calibrate the high-to-low dimensional mapping using the states. If False, assume the basis is already calibrated.

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. If None (default), set regularizer_factory() to the identity function.

gridsearch_onlybool

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

test_time_lengthfloat or None

Amount of time after the training regime in which to require model stability.

stability_marginfloat

Factor by which the predicted reduced states may deviate from the range of the training reduced states without the trajectory being classified as unstable.

test_caseslist of ContinuousRegTest objects

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

verbosebool

If True, print information during the regularization selection.

predict_optionsdict or None

Extra arguments for opinf.models.ContinuousModel.predict(), for example, method="BDF".

Returns:
self

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 ddts (if provided) is an (n, k) ndarray and that inputs (if provided) is a single callable.

The train_time_domains may be a single one-dimensional array, in which case it is assumed that each trajectory states[i] corresponds to the same time domain.