Skip to content
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

Rename Bunch keys #44

Merged
merged 5 commits into from
Jan 11, 2024
Merged

Conversation

YanisLalou
Copy link
Collaborator

@YanisLalou YanisLalou commented Jan 9, 2024

#25

  • Rename Bunch keys in the DomainAwareDataset def

@YanisLalou YanisLalou changed the title Rename Bunch keys to avoid confusion #25 Rename Bunch keys Jan 9, 2024
@@ -232,8 +232,8 @@ def pack(
target = np.concatenate(ys)
sample_domain = np.concatenate(sample_domains)
return (data, target, sample_domain) if return_X_y else Bunch(
Copy link
Collaborator

@rflamary rflamary Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should also change the variable nalmes in the for loop

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid confusion with the X and y in the for loop, I reuse the names Xs and ys instead of data and target respectively

@kachayev
Copy link
Collaborator

kachayev commented Jan 9, 2024

It seems those we mentioned in the docs as well (in the README file).

@kachayev
Copy link
Collaborator

kachayev commented Jan 9, 2024

Plus sample generator functions have documentation (not sure if they implement packing locally but worth checking out).

@kachayev
Copy link
Collaborator

kachayev commented Jan 9, 2024

The documentation for pack_lodo method of the base dataset has the same set of keys as well.

@kachayev
Copy link
Collaborator

kachayev commented Jan 9, 2024

Same for Office31 datasets.

@kachayev
Copy link
Collaborator

It seems the _load_office31 loader for the Office31 dataset still returns keys with old names.

@@ -470,4 +470,7 @@ def _load_office31(
data.append(content.astype(loader_spec.dtype))
files['data'] = np.vstack(data)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just set X and y here no need to add stuff and pop it

Copy link
Collaborator Author

@YanisLalou YanisLalou Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't. The files object comes from the load_files function, which is a sklearn function. Thus the keys 'data' and 'target' exist from the beginning.
Thus at some point we would have to remove these keys to not have duplicates with the keys 'X' and 'y'.
Thus the pop methods

@rflamary rflamary merged commit ea393d0 into scikit-adaptation:main Jan 11, 2024
1 check passed
@YanisLalou YanisLalou deleted the Issue_25_branch branch January 11, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants