-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring for pre- and post-processing, new design #232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hei @ndem0, I left some random comments reading through some of the changes. I did not do any testing, but i like the idea of having plugins for pre- and post- processing.
@@ -41,7 +41,10 @@ def fit(self, points, values): | |||
|
|||
if as_np_array.ndim == 1 or (as_np_array.ndim == 2 | |||
and as_np_array.shape[1] == 1): | |||
self.interpolator = interp1d(as_np_array, values, axis=0) | |||
|
|||
self.interpolator = interp1d(as_np_array, values, axis=0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to consider adding axis=0, bounds_error=False, **kwargs
to the arguments of fit(...)
. That way the user can control and specify these things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this class, it is quite difficult to keep that general layout, mainly because we are internally using two different methods depending on the input dimension!
|
||
@property | ||
def snapshots(self): | ||
def parameters_matrix(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small typo, could be changed to parameter_matrix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep the plural form at the moment, just to avoid changing all the tests! I'll refactor this class a bit.
|
||
@property | ||
def space(self): | ||
def snapshots_matrix(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo, could be changed to snapshot_matrix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep the plural form at the moment, just to avoid changing all the tests! I'll refactor this class a bit.
ezyrb/database.py
Outdated
""" | ||
if all(isinstance(n, int) for n in chunks): | ||
if sum(chunks) != len(self): | ||
raise ValueError('chunk elements are incosistent') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo, change to inconsistent
ezyrb/database.py
Outdated
|
||
elif all(isinstance(n, float) for n in chunks): | ||
if not np.isclose(sum(chunks), 1.): | ||
raise ValueError('chunk elements are incosistent') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
ezyrb/plugin/automatic_shift.py
Outdated
The plugin implements the atomatic "shifting" preprocessing: exploiting a | ||
machine learning framework, it is able to detect the quantity to shift the | ||
snapshots composing the database, such that the reduction method performs | ||
better, dipendentely by the problem at hand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo, "depending on ..."
ezyrb/plugin/automatic_shift.py
Outdated
|
||
class AutomaticShiftSnapshots(Plugin): | ||
""" | ||
The plugin implements the atomatic "shifting" preprocessing: exploiting a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: automatic
ezyrb/plugin/automatic_shift.py
Outdated
>>> def shift(time): | ||
>>> return time-0.5 | ||
>>> pod = POD() | ||
>>> rbf = RBF() | ||
>>> db = Database() | ||
>>> for param in params: | ||
>>> space, values = wave(param) | ||
>>> snap = Snapshot(values=values, space=space) | ||
>>> db.add(Parameter(param), snap) | ||
>>> rom = ROM(db, pod, rbf, plugins=[ShiftSnapshots(shift, RBF())]) | ||
>>> rom.fit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example is for ShiftSnapshots
not for AutomaticShiftSnapshots
No description provided.