-
Notifications
You must be signed in to change notification settings - Fork 1
♻️ Refactoring Sample container #125
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
base: main
Are you sure you want to change the base?
Conversation
Review these changes at https://app.gitnotebooks.com/PLAID-lib/plaid/pull/125 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Nice idea ! We could even have: from plaid.containers.sample import FeatureManager
class Sample:
def __init__(self):
self.features: list[FeatureManager] = []
... But how would requests to a class Sample:
def get_scalar(self, name):
return self.scalars.get_feature(name) |
Yes I guess that you can choose which methods you want to expose in |
Nice ! Having sample's only parameters |
About for example:
About the let me explain, for example the method |
It seams doable with class A(object):
def __init__(self):
self.val = {'a':1, 'b':2}
def __getattr__(self, attr):
if attr=='get_scalars':
def fun(name):
return self.val[name]
return fun
else:
raise AttributeError(f"'A' object has no attribute '{attr}'")
a = A()
a.get_scalars(name) |
Yes we could do that, the only issue I see is that the methods don't have the same signatures accross feature types. What would be the signature of the def get(self) -> T:
raise ...
def get(self, name: str) -> T:
raise ....
def get(self, name: str, **kwargs) -> T:
raise .... |
That's cool ! I think we could look at that after everything has been simply reorganized |
Here's a proposal regarding the refactorization of
Sample
. The idea is to end up with aSample
such as:And to have a layout such as:
I pushed (empty) examples for
ScalarManager
andTimeSeriesManager
just for opening the discussion. I haven't doneTimeSeriesManager
but it would be similar. What do you think about the naming (manager) and layout ? Once we agree on something, I can start implementing (mostly copy pasting I think).