opinf.models#

Dynamical systems model classes.

Overview

Model classes represent a set equations describing the dynamics of the model state. The user specifies the structure of the dynamics by providing a list of operators to the constructor. Model dynamics are calibrated through a least-squares regression of available state and input data.

import opinf

# Specify the model structure through a list of operators.
model = opinf.models.ContinuousModel(
    operators=[
        opinf.operators.LinearOperator(),
        opinf.operators.InputOperator(),
    ]
)

# Calibrate the model through Operator Inference.
model.fit(state_snapshots, state_time_derivatives, corresponding_inputs)

# Solve the model.
result = model.predict(initial_condition, time_domain, input_function)

Types of Models#

The models defined in this module can be classified in a few ways.

  1. Continuous vs Discrete: Continuous-time models are for systems of ordinary differential equations (ODEs), and discrete-time models are for discrete dynamical systems.

  2. Parametric vs Nonparametric: In a parametric model, the dynamics depend on one or more external parameters; a nonparametric model has no external parameter dependence.

Nonparametric Models#

A nonparametric model is comprised exclusively of nonparametric operators.

ContinuousModel

Nonparametric system of ordinary differential equations \(\ddt\qhat(t) = \fhat(\qhat(t), \u(t))\).

DiscreteModel

Nonparametric discrete dynamical system model \(\qhat_{j+1} = \fhat(\qhat_{j}, \u_{j})\).

Nonparametric model classes are initialized with a single argument, operators, that must be a list of nonparametric opinf.operators objects. The right-hand side of the model is defined to be the sum of the action of the operators on the model state and the input (if present). For example, a ContinuousModel represents a system of ODEs

\[ \begin{align*} \ddt\qhat(t) = \fhat(\qhat,\u) = \sum_{\ell=1}^{n_\textrm{terms}} \Ophat_{\ell}(\qhat(t),\u(t)) \end{align*} \]

where each \(\Ophat_{\ell}\) is a nonparametric operator.

Tip

The operators constructor argument for these classes can also be a string that indicates which type of operator to use.

Character

opinf.operators class

'c'

opinf.operators.ConstantOperator

'A'

opinf.operators.LinearOperator

'H'

opinf.operators.QuadraticOperator

'G'

opinf.operators.CubicOperator

'B'

opinf.operators.InputOperator

'N'

opinf.operators.StateInputOperator

import opinf

# Initialize the model with a list of operator objects.
model = opinf.models.DiscreteModel(
    operators=[
        opinf.operators.QuadraticOperator(),
        opinf.operators.InputOperator(),
    ]
)

# Equivalently, initialize the model with a string.
model = opinf.models.DiscreteModel(operators="HB")

The individual operators given to the constructor may or may not have their entries set. A model’s fit() method uses Operator Inference to calibrate the operators without entries through a regression problem, see Learning Operators from Data. Once the model operators are calibrated, nonparametric models may use the following methods.

  • rhs(): Compute the right-hand side of the model, i.e., \(\Ophat(\qhat, \u)\).

  • jacobian(): Construct the state Jacobian of the right-hand side of the model, i.e, \(\ddqhat\Ophat(\qhat,\u)\).

  • predict(): Solve the model with given initial conditions and/or inputs.

Parametric Models#

A parametric model is a model with at least one parametric operator.

Parametric models are similar to nonparametric models: they are initialized with a list of operators, use fit() to calibrate operator entries, and predict() to solve the model. In addition, parametric models have an evaluate() method that returns a nonparametric model at a fixed parameter value.

Interpolated Models#

Interpolated models consist exclusively of interpolated operators.

InterpolatedContinuousModel

Parametric system of ordinary differential equations \(\ddt\qhat(t; \bfmu) = \fhat(\qhat(t; \bfmu), \u(t); \bfmu)\) where the parametric dependence is handled by elementwise interpolation.

InterpolatedDiscreteModel

Parametric discrete dynamical system model \(\qhat(\bfmu)_{j+1} = \fhat(\qhat(\bfmu)_{j}, \u_{j}; \bfmu)\) where the parametric dependence is handled by elementwise interpolation.

Tip

The operators constructor argument for these classes can also be a string that indicates which type of operator to use.

Character

opinf.operators class

'c'

opinf.operators.InterpolatedConstantOperator

'A'

opinf.operators.InterpolatedLinearOperator

'H'

opinf.operators.InterpolatedQuadraticOperator

'G'

opinf.operators.InterpolatedCubicOperator

'B'

opinf.operators.InterpolatedInputOperator

'N'

opinf.operators.InterpolatedStateInputOperator

import opinf

# Initialize the model with a list of operator objects.
model = opinf.models.InterpolatedContinuousModel(
    operators=[
        opinf.operators.InterpolatedCubicOperator(),
        opinf.operators.InterpolatedStateInputOperator(),
    ]
)

# Equivalently, initialize the model with a string.
model = opinf.models.InterpolatedContinuousModel(operators="GN")