opinf.models#

Dynamical systems model classes.

Nonparametric Models

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})\).

Parametric Models

ParametricContinuousModel

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

ParametricDiscreteModel

Parametric discrete dynamical system model \(\qhat(\bfmu)_{j+1} = \Ophat(\qhat(\bfmu)_{j}, \u_{j}; \bfmu)\).

InterpContinuousModel

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.

InterpDiscreteModel

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.

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. Solvers for the least-squares problem are specified in the constructor.

import opinf

# Specify the model structure through a list of operators.
model = opinf.models.ContinuousModel(
    operators=[
        opinf.operators.LinearOperator(),
        opinf.operators.InputOperator(),
    ],
    solver=opinf.lstsq.L2Solver(1e-6),
)

# 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.

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.

ParametricContinuousModel

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

ParametricDiscreteModel

Parametric discrete dynamical system model \(\qhat(\bfmu)_{j+1} = \Ophat(\qhat(\bfmu)_{j}, \u_{j}; \bfmu)\).

Interpolatory Models#

Interpolatory models consist exclusively of interpolatory operators.

InterpContinuousModel

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.

InterpDiscreteModel

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.

import opinf

# Initialize the model with a list of operator objects.
model = opinf.models.InterpContinuousModel(
    operators=[
        opinf.operators.InterpCubicOperator(),
        opinf.operators.InterpStateInputOperator(),
    ]
)

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