Skip to content

Commit 087e080

Browse files
committed
fix: correct inverse_transform typos and improve error handling in scaler plugin
1 parent 5a05269 commit 087e080

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

ezyrb/plugin/scaler.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ class DatabaseScaler(Plugin):
1010
"""
1111
The plugin to rescale the database of the reduced order model. It uses a
1212
user defined `scaler`, which has to have implemented the `fit`, `transform`
13-
and `inverse_trasform` methods (i.e. `sklearn` interface), to rescale
13+
and `inverse_transform` methods (i.e. `sklearn` interface), to rescale
1414
the parameters and/or the snapshots. It can be applied at the full order
15-
(`mode='full'`), at the reduced one (`mode='reduced'`) or both of them
16-
(`mode='both'`).
15+
(`mode='full'`) or at the reduced one (`mode='reduced'`).
1716
1817
:param obj scaler: a generic object which has to have implemented the
19-
`fit`, `transform` and `inverse_trasform` methods (i.e. `sklearn`
18+
`fit`, `transform` and `inverse_transform` methods (i.e. `sklearn`
2019
interface).
2120
:param {'full', 'reduced'} mode: define if the rescaling has to be
2221
applied at the full order ('full') or at the reduced one ('reduced').
@@ -62,11 +61,14 @@ def target(self):
6261
rtype: str
6362
"""
6463
return self._target
64+
6565

6666
@target.setter
6767
def target(self, new_target):
6868
if new_target not in ["snapshots", "parameters"]:
69-
raise ValueError
69+
error_msg = f"Invalid target: '{new_target}' must be 'snapshots' or 'parameters'."
70+
logger.error(error_msg)
71+
raise ValueError(error_msg)
7072

7173
self._target = new_target
7274

@@ -82,10 +84,13 @@ def mode(self):
8284
@mode.setter
8385
def mode(self, new_mode):
8486
if new_mode not in ["full", "reduced"]:
85-
raise ValueError
87+
error_msg = f"Invalid mode: '{new_mode}' must be 'full' or 'reduced'."
88+
logger.error(error_msg)
89+
raise ValueError(error_msg)
8690

8791
self._mode = new_mode
8892

93+
8994
def _select_matrix(self, db):
9095
"""
9196
Helper function to select the proper matrix to rescale.

0 commit comments

Comments
 (0)