pymor.models.data_driven

Classes

DataDrivenInstationaryModel

Class for models of instationary problems that use regressors for prediction.

DataDrivenModel

Class for models of stationary problems that use regressors for prediction.

ModelOfDataDrivenModels

Model combining several sub-models into a single stacked solution.

class pymor.models.data_driven.DataDrivenInstationaryModel(T, nt, regressor, target_quantity='solution', parameters={}, dim_solution_space=None, input_scaler=None, output_scaler=None, time_vectorized=False, output_functional=None, products=None, error_estimator=None, visualizer=None, name='DataDrivenModel')[source]

Bases: DataDrivenModel

Class for models of instationary problems that use regressors for prediction.

This class implements a Model that uses a regressor for solution or output approximation.

Parameters:
  • T – In the instationary case, determines the final time until which to solve.

  • nt – Number of time steps.

  • regressor – Regressor with fit and predict methods similar to scikit-learn regressors that is used for prediction in _compute.

  • target_quantity – Either 'solution' or 'output', determines which quantity is predicted by the regressor.

  • parameters – Parameters of the reduced order model (the same as used in the full-order model).

  • dim_solution_space – Dimension of the solution space in case that target_quantity='solution'.

  • input_scaler – If not None, a scaler object with fit, transform and inverse_transform methods similar to the scikit-learn interface can be used to scale the parameters before passing them to the regressor.

  • output_scaler – If not None, a scaler object with fit, transform and inverse_transform methods similar to the scikit-learn interface can be used to scale the outputs (reduced coefficients or output quantities) before passing them to the regressor.

  • time_vectorized – In the instationary case, determines whether to predict the whole time trajectory at once (time-vectorized version; output of the regressor is typically very high-dimensional in this case) or if the result for a single point in time is approximated (time serves as an additional input to the regressor).

  • output_functional – Operator mapping a given solution to the model output. In many applications, this will be a Functional, i.e. an Operator mapping to scalars. This is not required, however.

  • products – A dict of inner product Operators defined on the discrete space the problem is posed on. For each product with key 'x' a corresponding attribute x_product, as well as a norm method x_norm is added to the model.

  • error_estimator – An error estimator for the problem. This can be any object with an estimate_error(U, mu, m) method. If error_estimator is not None, an estimate_error(U, mu) method is added to the model which will call error_estimator.estimate_error(U, mu, self).

  • visualizer – A visualizer for the problem. This can be any object with a visualize(U, m, ...) method. If visualizer is not None, a visualize(U, *args, **kwargs) method is added to the model which forwards its arguments to the visualizer’s visualize method.

  • name – Name of the model.

class pymor.models.data_driven.DataDrivenModel(regressor, target_quantity='solution', parameters={}, dim_solution_space=None, input_scaler=None, output_scaler=None, output_functional=None, products=None, error_estimator=None, visualizer=None, name='DataDrivenModel')[source]

Bases: Model

Class for models of stationary problems that use regressors for prediction.

This class implements a Model that uses a regressor for solution or output approximation.

Parameters:
  • regressor – Regressor with fit and predict methods similar to scikit-learn regressors that is used for prediction in _compute.

  • target_quantity – Either 'solution' or 'output', determines which quantity is predicted by the regressor.

  • parameters – Parameters of the reduced order model (the same as used in the full-order model).

  • dim_solution_space – Dimension of the solution space in case that target_quantity='solution'.

  • input_scaler – If not None, a scaler object with fit, transform and inverse_transform methods similar to the scikit-learn interface can be used to scale the parameters before passing them to the regressor.

  • output_scaler – If not None, a scaler object with fit, transform and inverse_transform methods similar to the scikit-learn interface can be used to scale the outputs (reduced coefficients or output quantities) before passing them to the regressor.

  • output_functional – Operator mapping a given solution to the model output. In many applications, this will be a Functional, i.e. an Operator mapping to scalars. This is not required, however.

  • products – A dict of inner product Operators defined on the discrete space the problem is posed on. For each product with key 'x' a corresponding attribute x_product, as well as a norm method x_norm is added to the model.

  • error_estimator – An error estimator for the problem. This can be any object with an estimate_error(U, mu, m) method. If error_estimator is not None, an estimate_error(U, mu) method is added to the model which will call error_estimator.estimate_error(U, mu, self).

  • visualizer – A visualizer for the problem. This can be any object with a visualize(U, m, ...) method. If visualizer is not None, a visualize(U, *args, **kwargs) method is added to the model which forwards its arguments to the visualizer’s visualize method.

  • name – Name of the model.

class pymor.models.data_driven.ModelOfDataDrivenModels(models, output_functional=None, error_estimator=None)[source]

Bases: Model

Model combining several sub-models into a single stacked solution.

The solutions of the sub-models are stacked into a single solution vector whose space is the direct sum of the sub-model solution spaces. Used by AdaptiveDataDrivenReductor to combine the data-driven surrogates for the individual blocks of reduced basis coefficients into one model.

Parameters:
  • models – Sequence of DataDrivenModel sub-models with NumpyVectorSpace solution spaces.

  • output_functional – Operator mapping the stacked solution to the model output.

  • error_estimator – Error estimator operating on the stacked solution (e.g. the error estimator of the reduced basis model whose coefficients are approximated).