Aggregation
- class Aggregation(fit_function=None, predict_function=<ezyrb.approximation.linear.Linear object>)[source]
Bases:
PluginThe Aggregation plugin class. It implements a general framework for space-dependent aggregation of multiple reduced order models (ROMs). The aggregation weights can be computed either through standard space-dependent methods (e.g., Gaussian functions) or by fitting a regression/interpolation model (e.g., RBF, linear, ANN) on the validation set.
Reference: Ivagnes A., Tonicello N., Rozza G. (2024). Enhancing non-intrusive reduced-order models with space-dependent aggregation methods, Acta Mechanica.
- Parameters:
fit_function – a regression/interpolation model to fit the weights in the validation set. If None, standard space-dependent aggregation methods are used (default is None).
predict_function – a regression/interpolation model to predict the weights in the test set. Default is a linear interpolation.
Example: >>> from ezyrb import POD, RBF, GPR, Database, Snapshot, Parameter, Linear, ANN >>> from ezyrb import ReducedOrderModel as ROM >>> from ezyrb.plugin import Aggregation >>> pod = POD(rank=10) >>> rbf = RBF() >>> gpr = GPR() >>> db = Database(param, snapshots.T) >>> rom1 = ROM(db, pod, rbf) >>> rom2 = ROM(db, pod, gpr) >>> mrom = MROM({‘rbf’: rom1, ‘gpr’: rom2}, plugins=[Aggregation( … fit_function=None, predict_function=Linear())]) >>> mrom.fit() >>> pred = mrom.predict(new_param)
Initialize the Aggregation plugin.
- Parameters:
fit_function – Regression model to fit weights in validation set. If None, uses standard space-dependent methods. Default is None.
predict_function – Regression model to predict weights in test set. Default is Linear().
- _abc_impl = <_abc._abc_data object>
- _check_sum_gaussians(mrom, sum_gaussians, gaussians)[source]
Method to check if the sum of the Gaussian functions is on-zero in all the points of the validation set. If there are zero values, the same weight/gaussian is taken for all the ROMs at those points.
- Parameters:
mrom – the multi reduced order model.
sum_gaussians – the sum of the Gaussian functions.
gaussians – the Gaussian functions.
- Returns:
the corrected Gaussian functions.
- _compute_validation_weights(mrom, sigma, normalized=False)[source]
Method to compute the weights in the validation set through standard space-dependent aggregation methods.
- Parameters:
mrom – the multi reduced order model.
sigma – the sigma parameter in the Gaussian functions.
normalized – if True, the weights are normalized to sum to 1 at each spatial point (default is False).
- Returns:
the weights in the validation set.
- _optimize_sigma(mrom, sigma_range=[1e-05, 0.01])[source]
Method to optimize the sigma parameter in the Gaussian functions through a minimization procedure on the validation set.
- Parameters:
mrom – the multi reduced order model.
sigma_range – the range of values to search for the optimal sigma.
- Returns:
the optimal sigma value.
- fit_postprocessing(mrom)[source]
Compute/fit the weights in the validation set. If fit_function is None, the weights are computed through standard space-dependent aggregation methods (e.g., Gaussian functions). If fit_function is not None, the weights are fitted through the provided regression/interpolation model (e.g., RBF, linear, ANN).
- Parameters:
mrom – the multi reduced order model.
- Returns:
None
- predict_postprocessing(mrom)[source]
Compute the weights in the test set and the predicted solution as a convex combination of the predicted solutions of the individual ROMs.
- Parameters:
mrom – the multi reduced order model.
- Returns:
None