DatabaseScaler
Module for Scaler plugin
- class DatabaseScaler(scaler, mode, target)[source]
Bases:
PluginThe plugin to rescale the database of the reduced order model. It uses a user defined scaler, which has to have implemented the fit, transform and inverse_trasform methods (i.e. sklearn interface), to rescale the parameters and/or the snapshots. It can be applied at the full order (mode=’full’), at the reduced one (mode=’reduced’) or both of them (mode=’both’).
- Parameters:
scaler (obj) – a generic object which has to have implemented the fit, transform and inverse_trasform methods (i.e. sklearn interface).
mode ({'full', 'reduced'}) – define if the rescaling has to be applied at the full order (‘full’) or at the reduced one (‘reduced’).
params ({'parameters', 'snapshots'}) – define if the rescaling has to be applied to the parameters or to the snapshots.
- Example:
>>> from ezyrb import ReducedOrderModel as ROM >>> from ezyrb import POD, RBF, Database >>> from ezyrb.plugin import DatabaseScaler >>> from sklearn.preprocessing import StandardScaler >>> pod = POD(rank=10) >>> rbf = RBF() >>> db = Database(params, snapshots) >>> scaler = DatabaseScaler(StandardScaler(), 'full', 'snapshots') >>> rom = ROM(db, pod, rbf, plugins=[scaler]) >>> rom.fit()
Initialize the DatabaseScaler plugin.
- Parameters:
- _abc_impl = <_abc._abc_data object>
- _select_matrix(db)[source]
Helper function to select the proper matrix to rescale.
- Parameters:
db (Database) – The database object.
- Returns:
The selected matrix (parameters or snapshots).
- fom_postprocessing(rom)[source]
- fom_preprocessing(rom)[source]
- property mode
Get the type of scaling. See class documentation for more info.
rtype: str
- rom_postprocessing(rom)[source]
- rom_preprocessing(rom)[source]
Apply scaling to the reduced database before ROM processing.
- Parameters:
rom (ReducedOrderModel) – The ROM instance.
- property target
Get the type of scaling. See class documentation for more info.
rtype: str