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 asolver
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 valueparameters[i]
; each columnstates[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 ofstates[i]
; each columnddts[i][:, j]
corresponds to the snapshotstates[i][:, j]
. IfNone
(default), these are estimated usingddt_estimator
.- input_functionslist of s callables or None
Input functions mapping time to input vectors. Only required if the
model
takes external inputs. Eachinput_functions[i]
is the function corresponding tostates[i]
, andinput_functions[i](train_time_domains[i][j])
is the input vector corresponding to the snapshotstates[i][:, j]
.- fit_transformerbool
If
True
(default), calibrate the preprocessing transformation using thestates
. IfFalse
, assume the transformer is already calibrated.- fit_basisbool
If
True
(default), calibrate the high-to-low dimensional mapping using thestates
. IfFalse
, 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 tomodel.solver.regularizer
for eachi
. IfNone
(default), setregularizer_factory()
to the identity function.- gridsearch_onlybool
If
True
, stop after checking all regularizationcandidates
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 thatddts
(if provided) is an (n, k) ndarray and thatinputs
(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 trajectorystates[i]
corresponds to the same time domain.