-
Notifications
You must be signed in to change notification settings - Fork 2
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
Stratified/equal sampling in FewShotDataLoader #15
Conversation
coverage
|
liltab/data/datasets.py
Outdated
@@ -66,8 +67,10 @@ def __init__( | |||
|
|||
self.y = self.df[self.target_columns] | |||
if self.encode_categorical_target: | |||
self.y = pd.get_dummies(self.y.astype("category")) | |||
self.y = torch.from_numpy(self.y.to_numpy()).type(torch.float32) | |||
self.one_hot_encoder = OneHotEncoder(sparse=False).set_output(transform="pandas") |
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.
RandomFeaturesPandasDataset needs to have the same logic applied (target_column and cases, self.raw_y etc.)
|
||
self.curr_episode = 0 | ||
|
||
self.n_rows = len(self.dataset) | ||
|
||
if sample_classes_equally: | ||
self.y = dataset.raw_y |
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 step can be done in datasets
module with one-hot from pytorch (https://pytorch.org/docs/stable/generated/torch.nn.functional.one_hot.html) and reduce memory allocation (both self.y and self.raw_y in datasets)
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.
Main requested changes:
- implement PandasDataset new functionalities to RandomFeaturesPandasDataset
- reduce code in init of FewShotDataLoader and also move it to new function
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.
Main requested changes:
- implement PandasDataset new functionalities to RandomFeaturesPandasDataset
- reduce code in init of FewShotDataLoader and also move it to new function
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.
Ok
No description provided.