fit_regselect_continuous()#
- BayesianROM.fit_regselect_continuous(candidates: list, train_time_domains: 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, num_posterior_draws: int = 20, test_cases: list = None, verbose: bool = False, **predict_options: dict)[source]#
Calibrate the time-continuous model to training data, selecting the regularization hyperparameter(s) that minimize the sample mean training error while maintaining stability over the testing regime.
This method requires the
modelto be time-continuous; usefit_regselect_discrete()for discrete models. Themodel.solver.regularizeris repeatedly adjusted, and the operatorposterioris recalibrated, until a best regularization is selected. Training error is measured by comparing training data to the sample mean ofnum_posterior_drawsmodel predictions. Stability is required for each of the individual model predictions. See [GMW22, MHW21].- 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.
- 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 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
modeltakes 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.regularizerfor eachi. IfNone(default), setregularizer_factory()to the identity function.- gridsearch_onlybool
If
True, stop after checking all regularizationcandidatesand 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.
- num_posterior_drawsint
Number of draws from the operator
posteriorfor stability checks and for estimating the sample mean of model predictions.- 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().
Notes
If there is only one trajectory of training data (s = 1),
statesmay be provided as an (n, k) ndarray. In this case, it is assumed thatddts(if provided) is an (n, k) ndarray.The
train_time_domainsmay be a single one-dimensional array, in which case it is assumed that each trajectorystates[i]corresponds to the same time domain. Similarly, ifinput_functionsis a single callable, it is assumed to be the input function for each trajectory.