What’s New#
Attention
opinf is a research code that is still in rapid development.
New versions may introduce substantial new features or API adjustments.
Version 0.5.16#
Backend improvements to the regularization selection procedure.
ROM.fit()callsROM.model.fit()instead ofROM.model._fit_solver(), which works better for inheritance.BayesianROM.fit_regselect_*()catches errors and suppresses warnings from the least-squares solver.Fixed a bug for interpolatory parametric models where
fit_regselect_*()would only update the regularizer for the overallmodel.solver, not for each of the individual solvers for the models to be interpolated.Fixed a bug related to test cases being processed before the basis was initialized.
Removed unnecessary abstract methods from
models.mono._base._OpInfModel.Small updates to the literature page.
Version 0.5.15#
Improvement to
fit_regselect_*()so that the regularization does not have to be initialized before fitting the model. This fixes a longstanding chicken/egg problem and makes usingfit_regselect_*()much less cumbersome.Ensured error computation correctly aligns training and predicted states in
fit_regselect_continuous(). Previously, this could have been misaligned when using a time derivative estimator that truncates states.Time derivative estimators in
opinf.ddtnow have amask()method that map states to the estimation grid.Added regression tests based on the tutorial notebooks.
Added
pytestandpytest-covto the dependencies for developers.
Version 0.5.14#
Catch any errors in
fit_regselect*()that occur when the model usesrefit().Tikhonov-type least-squares solvers do not require the regularizer in the constructor but will raise an
AttributeErrorinsolve()(and other methods) if the regularizer is not set.PODBasis.fit(Q)raises a warning when using the"method-of-snapshots"/"eigh"strategy if \(n < k\) for \(\mathbf{Q}\in\mathbb{R}^{n \times k}.\) In this case, calculating the \(n \times k\) SVD is likely more efficient than the \(k \times k\) eigenvalue problem.Added Python 3.13 to list of tests.
Version 0.5.13#
Bayesian operator inference:
New
roms.BayesianROMclass.New supporting class
roms.OperatorPosterior.Updates to relevant least-squares solvers.
These changes implement the framework proposed in [GMW22].
Version 0.5.12#
New
operators.QuarticOperator, plus unit tests.Reorganized some unit tests for models and operators to have OOP structure.
Bugfix:
fit_regselect_continuous()now returnsself
Version 0.5.11#
New scaling option for
pre.ShiftScaleTransformerso that training snapshots have at maximum norm 1. Contributed by @nicolearetz.Small clarifications to
pre.ShiftScaleTransformerand updates to thepredocumentation.
Version 0.5.10#
New POD basis solver option basis.PODBasis(solver="method-of-snapshots") (or solver="eigh"), which solves a symmetric eigenvalue problem instead of computing a (weighted) SVD. This method is more efficient than the SVD for snapshot matrices \(\mathbf{Q}\in\mathbb{R}^{n\times k}\) where \(n \gg k\) and is significantly more efficient than the SVD when a non-diagonal weight matrix is provided.
Contributed by @nicolearetz.
Version 0.5.9#
Automatic regularization selection:
New methods
fit_regselect_continuous()andfit_regselect_discrete()in theROMandParametricROMclasses.utils.gridsearch()implements grid search followed up by derivative-free log-scale optimization.Class method
TikhonovSolver.get_operator_regularizer()to construct diagonal Tikhonov regularizers where each operator is regularized by a different scalar.
New transformers for custom shifting / scaling:
pre.ShiftTransformerpre.ScaleTransformerpre.NullTransformerpre.TransformerPipeline
Small improvements:
Executing individual test files now runs the tests contained within.
utils.TimedBlockhas arebufferattribute that, when set toTrue, prevents printing until the end of the block.Improved test coverage, fixed some documentation typos, etc.
Version 0.5.8#
Support for affine-parametric problems:
Affine-parametric operator classes
AffineConstantOperator,AffineLinearOperator, etc.Parametric model classes
ParametricContinuousModel,ParametricDiscreteModel.ParametricROMclass.Updates to operator / model documentation.
Renamed interpolatory operators / model classes from Interpolated<Name> to Interp<Name>.
Old names are deprecated but not yet removed.
Miscellaneous:
Reorganized and expanded tutorials.
Added and documented
opinf.utils.TimedBlockcontext manager for quick timing of code blocks.Updated structure for some unit tests.
Refactored interpolatory operators.
Standardized string representations, added
[Parametric]ROM.__str__().Removed some public functions from
operators, regrouped inoperators._utils.Removed some public functions from
models, regrouped inmodels._utils.
Version 0.5.7#
Updates to opinf.lstsq:
New
TruncatedSVDSolverclass.predict()has been renamedsolve()foropinf.lstsqsolver classes to not clash withpredict()fromopinf.roms/opinf.modelsclasses.solve()always returns a two-dimensional array, even if \(r = 1\).
Various small improvements to tests and documentation.
Version 0.5.6#
Added public templates to opinf.operators:
OperatorTemplatefor general nonparametric operators.OpInfOperatorfor nonparametric operators that can be learned through Operator Inference (operator matrix times data vector structure).ParametricOperatorTemplatefor general parametric operators.ParametricOpInfOperatorfor parametric operators that can be learned through Operator Inference.
Also added a new opinf.ddt.InterpolationDerivativeEstimator class and made various small changes for compatibility with NumPy 2.0.0.
Version 0.5.5#
Changes to the opinf.lstsq API and improvements to the documentation.
opinf.modelclasses now receive solvers in the constructor, not in fit(). This change will be useful for future models that require specific solvers. UpdatedROMclass and tutorials accordingly.New
SolverTemplateclass and inheritance guide for creating new solvers.Renamed attributes to match OpInf terminology.
A --> data_matrix, called \(\D\) in the docs.B --> lhs_matrix, called \(\Z\) in the docs. Warning:fit()receives \(\Z\), not \(\Z\trp\)!\(X\) is replaced with \(\Ohat\). Warning:
predict()returns \(\Ohat\), not \(\Ohat\trp\)!
Renamed two Tikhonov solver classes:
L2SolverDecoupled --> L2DecoupledSolverTikhonovSolverDecoupled --> TikhonovDecoupledSolver
Tikhonov solvers no longer have a default regularization value of zero.
Before:
>>> model = opinf.models.ContinuousModel("A")
>>> solver = opinf.lstsq.L2Solver(regularizer=1e-2)
>>> model.fit(states, ddts, inputs, solver=solver)
After:
>>> solver = opinf.lstsq.L2Solver(regularizer=1e-2)
>>> model = opinf.models.ContinuousModel("A", solver=solver)
>>> model.fit(states, ddts, inputs)
Version 0.5.4#
New opinf.roms submodule containing an opinf.roms.ROM class, also available in the main namespace as opinf.ROM.
This class wraps a lifter, transformer, basis, time derivative estimator, model, and least-squares solver together for convenience.
Rewrote the first tutorial to use opinf.ROM.
Version 0.5.3#
Expanded the ddt submodule (but no API changes to existing functions).
New backward, central, and forward difference schemes up to sixth order.
New
DerivativeEstimatorTemplateclass for implementing custom derivative estimation strategies.New
UniformFiniteDifferenceandNonuniformFiniteDifferenceconvenience classes for working withROMclasses in the future.Better documentation of the module.
The documentation was also updated to JupyterBook 1.0.0, a significant improvement to the look and feel.
Tests are now managed with tox, the contributor instructions were updated.
Version 0.5.2#
Significant updates to the pre and basis submodules.
Updates to pre:
New
TransformerTemplateclass for defining custom transformers.Renamed
SnapshotTransformertoShiftScaleTransformer.Removed
SnapshotTransformerMulti.New
TransformerMulticlass for joining multiple transformations.Renamed some attributes of the transformer classes:
n->full_state_dimension,ni->variable_size, etc.
Updates to basis:
New
BasisTemplateclass for defining custom bases.Standardized arguments of
fit()to always be the snapshots. Hyperparameters must come in the constructor.LinearBasisnow accepts an optional weight matrix.LinearBasisraises a warning if the basis entries are not orthogonal (w.r.t. the weights).Updated
PODBasisdimensionality properties. Useset_dimension()to update the reduced state dimension on the fly.Removed
PODBasisMulti.New
BasisMultimulti class for joining multiple bases.Renamed some attributes of the basis classes (matching transformer syntax):
n->full_state_dimension,r->reduced_state_dimension, etc.
Added a new Literature page to the documentation listing Operator Inference publications.
Version 0.5.1#
New lift module that defines a template class for implementing lifting transformations.
Version 0.5.0#
Overhauled the
operatorsmodule so that each operator class is responsible for its portion of the Operator Inference data matrix.New
StateInputOperatorfor state-input bilinear interactions, \(\Nhat[\u\otimes\qhat]\).Operator classes now have
state_dimensionandinput_dimensionproperties.Operator classes must implement
datablock()andoperator_dimension()methods to facilitate operator inference.
Renamed
romstomodelsand updated class names:ContinuousOpInfROMtoContinuousModelDiscreteOpInfROMtoDiscreteModelSteadyOpInfROMtoSteadyModelSame for interpolated models.
Model classes now take a list of operators in the constructor. String shortcuts such as
"cAH"are still valid, similar to the previousmodelformargument. Theknown_operatorsargument has been removed from thefit()method.Model classes no longer have a
basisattribute.The
basisargument has been removed from thefit()method.The
compress()anddecompress()methods have been removed from model classes.The dimensions
nandrhave been replaced withstate_dimension;mis nowinput_dimension.
Moved time derivative estimation tools to the new
ddtsubmodule.Moved Kronecker product utilities to static methods of nonparametric operators.
utils.kron2c()is nowQuadraticOperator.ckron()utils.kron2c_indices()is nowQuadraticOperator.ckron_indices()utils.compress_quadratic()is nowQuadraticOperator.compress_entries()utils.expand_quadratic()is nowQuadraticOperator.expand_entries()utils.kron3c()is nowCubicOperator.ckron()utils.kron3c_indices()is nowCubicOperator.ckron_indices()utils.compress_cubic()is nowCubicOperator.compress_entries()utils.expand_cubic()is nowCubicOperator.expand_entries()
Version 0.4.5#
Moved basis classes and dimensionality reduction tools to a new
basissubmodule.Moved operator classes from
core.operatorsto a newoperatorssubmodule.Renamed the
coresubmodule toroms.Moved time derivative estimation tools to the
utilsmodule.
Version 0.4.4#
Fixed a bug in
SnapshotTransformer.load()that treated thecentered_attribute incorrectly.Removed the
transformerattribute from basis classes.Renamed
encode()tocompress()anddecode()todecompress().
Version 0.4.2#
In the
fit()method in ROM classes, replaced theregularizerargument with asolverkeyword argument. The user should pass in an instantiation of a least-squares solver class from thelstsqsubmodule.Hyperparameters for least-squares solver classes in the
lstsqsubmodule are now passed to the constructor;predict()must not take any arguments.Renamed the following least-squares solver classes in the
lstsqsubmodule:SolverL2->L2SolverSolverL2Decoupled->L2SolverDecoupledSolverTikhonov->TikhonovSolverSolverTikhonovDecoupled->TikhonovSolverDecoupled
Before:
>>> rom.fit(basis, states, ddts, inputs, regularizer=1e-2)
After:
>>> solver = opinf.lstsq.L2Solver(regularizer=1e-2)
>>> rom.fit(basis, states, ddts, inputs, solver=solver)
# The L2 solver is also the default if a float is given:
>>> rom.fit(basis, states, ddts, inputs, solver=1e-2)
Versions 0.4.0 and 0.4.1#
This version is a migration of the old rom_operator_inference package, version 1.4.1.
See this page for the documentation.