pymor.reductors.data_driven¶
Module Contents¶
- class pymor.reductors.data_driven.DataDrivenPODReductor(training_parameters, training_snapshots, regressor=None, T=None, time_vectorized=False, output_functional=None, input_scaler=None, output_scaler=None, product=None, pod_params=None)[source]¶
Bases:
DataDrivenReductorReductor building a reduced basis and relying on a machine learning surrogate.
In addition to the
DataDrivenReductor, this reductor uses snapshot data in order to construct a reduced basis via POD and projects the snapshots onto the reduced basis to generate data for the machine learning training. The approach is described in [HU18]. SeeDataDrivenReductorfor more details.- Parameters:
training_parameters –
Parameter valuesto use for training of the regressor.training_snapshots –
VectorArrayto use for the training of the regressor. Contains the solutions or outputs associated to the parameters intraining_parameters. In the case of a time-dependent problem, the snapshots are assumed to be equidistant in time.regressor – See
DataDrivenReductor.T – See
DataDrivenReductor.time_vectorized – See
DataDrivenReductor.output_functional –
Operatormapping a given solution to the model output. In many applications, this will be aFunctional, i.e. anOperatormapping to scalars. This is not required, however. The output functional will be projected automatically onto the reduced space.input_scaler – See
DataDrivenReductor.output_scaler – See
DataDrivenReductor.product – Inner product
Operatorsdefined on the discrete space the problem is posed on. Used for reduced basis computation via POD and or orthogonal projection onto the reduced basis.pod_params – Dict of additional parameters for the POD-method.
Methods
Add sequences of parameters and corresponding snapshots to the training data.
Reconstruct high-dimensional vector from reduced vector
u.Reduce by training a machine learning surrogate.
- class pymor.reductors.data_driven.DataDrivenReductor(training_parameters, training_snapshots, regressor=None, target_quantity='solution', T=None, time_vectorized=False, output_functional=None, input_scaler=None, output_scaler=None)[source]¶
Bases:
pymor.core.base.BasicObjectReductor relying on a machine learning surrogate.
The reductor works for stationary as well as for instationary problems and returns a suitable model for the respective case.
Depending on the argument
target_quantity, this reductor either approximates the solution or the output as a parametric quantity by training a machine learning surrogate.In case of an approximation of the solution, the reductor trains a machine learning regressor that approximates the mapping from parameter space to a
NumPy array. Typically, the array contains coefficients of the solution with respect to a reduced basis.For
target_quantity='output', the machine learning regressor directly approximates the output depending on the parameter. The outputs for the training parameters are either computed using the full-order model or can be provided as thetraining_snapshotsargument.- Parameters:
training_parameters –
Parameter valuesto use for training of the regressor.training_snapshots – Iterable containing the training snapshots of the regressor. Contains the solutions (reduced coefficients w.r.t. the reduced basis or outputs) associated to the parameters in
training_parameters. In the case of a time-dependent problem, the snapshots are assumed to be equidistant in time.regressor – Regressor with
fitandpredictmethods similar to scikit-learn regressors that is trained in thereduce-method. IfNone(which is also the default), aVKOGARegressoris used.target_quantity – Either
'solution'or'output', determines which quantity to learn.T – In the instationary case, determines the final time until which to solve.
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 –
Operatormapping a given solution to the model output. In many applications, this will be aFunctional, i.e. anOperatormapping to scalars. This is not required, however.input_scaler – If not
None, a scaler object withfit,transformandinverse_transformmethods 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 withfit,transformandinverse_transformmethods similar to the scikit-learn interface can be used to scale the outputs (reduced coeffcients or output quantities) before passing them to the regressor.
Methods
Add sequences of parameters and corresponding snapshots to the training data.
Reduce by training a machine learning surrogate.