fit()#

_InterpolatedModel.fit(parameters, states, lhs, inputs=None, solver=None)#

Learn the model operators from data.

The operators are inferred by solving the regression problem

\[\min_{\Ophat} \sum_{i=1}^{s}\sum_{j=0}^{k_{i}-1}\left\| \Ophat(\qhat_{i,j}, \u_{i,j}; \bfmu_i) - \dot{\qhat}_{i,j} \right\|_2^2\]

where \(\zhat = \Ophat(\qhat, \u)\) is the model and

  • \(\qhat_j\in\RR^r\) is a measurement of the state,

  • \(\u_j\in\RR^m\) is a measurement of the input, and

  • \(\zhat_j\in\RR^r\) is a measurement of the left-hand side of the model.

The operator matrix \(\Ohat\in\RR^{r\times d(r,m)}\) is such that \(\Ophat(\q,\u) = \Ohat\d(\qhat,\u)\) for some data vector \(\d(\qhat,\u)\in\RR^{d(r,m)}\); the data matrix \(\D\in\RR^{k\times d(r,m)}\) is given by \([~\d(\qhat_0,\u_0)~~\cdots~~\d(\qhat_{k-1},\u_{k-1})~]\trp\). Finally, \(\Zhat = [~\zhat_0~~\cdots~~\zhat_{k-1}~]\in\RR^{r\times k}\). See the opinf.operators module for more explanation.

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 training data are available.

stateslist of s (r, k) 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.

lhslist of s (r, k) ndarrays

Left-hand side training data. Each array lhs[i] is the data corresponding to parameter value parameters[i]; each column lhs[i][:, j] corresponds to the snapshot states[i][:, j]. The interpretation of this argument depends on the setting: forcing data for steady-state problems, next iteration for discrete-time problems, and time derivatives of the state for continuous-time problems.

inputslist of s (m, k) or (k,) 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