fit()#

InterpolatedDiscreteModel.fit(parameters, states, nextstates=None, inputs=None, solver=None, *, regularizer: float = None)#

Learn the model operators from data.

The operators are inferred by solving the regression problem

\[\min_{\Ohat^{(1)},\ldots,\Ohat^{(s)}} \sum_{i=1}^{s}\sum_{j=0}^{k_{i}-1}\left\| \Ophat(\qhat_{i,j}, \u_{i,j}; \bfmu_i) - \zhat_{i,j} \right\|_2^2 = \min_{\Ohat^{(1)},\ldots,\Ohat^{(s)}} \sum_{i=1}^{s}\left\| \D^{(i)}(\Ohat^{(i)})\trp - [~\zhat_{i,0}~~\cdots~~\zhat_{i,k_{i}-1}~]\trp \right\|_F^2\]

where \(\zhat(\bfmu)_{j} = \Ophat(\qhat(\bfmu)_{j}, \u_{j}; \bfmu) = \Ohat(\bfmu)\d(\qhat(\bfmu)_{j}, \u_{j})\) is the model and

  • \(\qhat_{i,j}\in\RR^r\) is the \(j\)-th measurement of the state corresponding to training parameter value \(\bfmu_i\),

  • \(\u_{i,j}\in\RR^m\) is the \(j\)-th measurement of the input corresponding to training parameter value \(\bfmu_i\),

  • \(\dot{qhat}_{i,j}\in\RR^r\) is a measurement of the time derivative of the state corresponding to the state-input pair \((\qhat_{i,j},\u_{i,j})\),

  • \(\Ohat^{(i)} = \Ohat(\bfmu)\) is the operator matrix evaluated at training parameter value \(\bfmu_i\), and

  • \(\D^{(i)}\) is the data matrix for data corresponding to training parameter value \(\bfmu_i\), given by \([~\d(\qhat_{i,0},\u_{i,0})~~\cdots~~ \d(\qhat_{i,k_i-1},\u_{i,k_i-1})~]\trp\).

Because all operators in this model are interpolatory, the least-squares problem decouples into \(s\) individual regressions. That is, for \(i = 1, \ldots, s\), we solve (independently) the regressions

\[\min_{\Ohat^{(i)}}\left\| \D^{(i)}(\Ohat^{(i)})\trp - [~\zhat_{i,0}~~\cdots~~\zhat_{i,k_{i}-1}~]\trp \right\|_F^2\]

and define the full operator matrix via elementwise interpolation,

\[\Ohat(\bfmu) = \textrm{interpolate}( (\bfmu_1, \Ohat^{(i)}), \ldots, (\bfmu_s, \Ohat^{(s)}); \bfmu).\]

The strategy for solving the regression, as well as any additional regularization or constraints, are specified by the solver.

Parameters
parameterslist of s scalars or (p,) 1D ndarrays

Parameter values for which the operator entries are known or will be inferred from data.

stateslist of s (r, k_i) ndarrays

Snapshot training data. Each array states[i] is the data corresponding to parameter value parameters[i]; each column states[i][:, j] is a single snapshot.

nextstateslist of s (r, k_i) ndarrays

Next iteration training data. Each array nextstates[i] is the data corresponding to parameter value parameters[i]; each column nextstates[i][:, j] is the iteration following states[i][:, j].

inputslist of s (m, k_i) or (k_i,) ndarrays, or None

Input training data. Each array inputs[i] is the data corresponding to parameter value parameters[i]; each column inputs[i][:, j] corresponds to the snapshot states[:, j]. May be a two-dimensional array if m=1 (scalar input).

solveropinf.lstsq object or float > 0 or None

Solver for the least-squares regression. Defaults:

Returns
self