fit()#
- InterpContinuousModel.fit(parameters, states, ddts, inputs=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) - \dot{\qhat}_{i,j} \right\|_2^2 = \min_{\Ohat^{(1)},\ldots,\Ohat^{(s)}} \sum_{i=1}^{s}\left\| \D^{(i)}(\Ohat^{(i)})\trp - [~\dot{\qhat}_{i,0}~~\cdots~~\dot{\qhat}_{i,k_{i}-1}~]\trp \right\|_F^2\]where \(\ddt\qhat(t; \bfmu) = \Ophat(\qhat(t; \bfmu), \u(t); \bfmu) = \Ohat(\bfmu)\d(\qhat(t; \bfmu), \u(t))\) 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 \(\qhat_{i,j}\), i.e., \(\dot{\qhat}_{i,j} = \ddt\qhat(t; \bfmu_i)\big|_{t=t_{i,j}}\) where qhat_{i,j} = qhat(t_{i,j};bfmu_i),
\(\Ohat^{(i)} = \Ohat(\bfmu_i)\) 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 - [~\dot{\qhat}_{i,0}~~\cdots~~\dot{\qhat}_{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
in the constructor.- 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 valueparameters[i]
; each columnstates[i][:, j]
is a single snapshot.- ddtslist of s (r, k_i) ndarrays
Snapshot time derivative data. Each array
ddts[i]
is the data corresponding to parameter valueparameters[i]
; each columnddts[i][:, j]
corresponds to the snapshotstates[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 valueparameters[i]
; each columninputs[i][:, j]
corresponds to the snapshotstates[i][:, j]
. May be a two-dimensional array if \(m=1\) (scalar input). Only required if one or more model operators depend on inputs.
- Returns:
- self