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

Enhance WILDSSubset to support flexible data returns #156

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rdarbinyan
Copy link

Summary

This update modifies the WILDSSubset class to support flexible return types from its __getitem__ method, accommodating both standard and custom dataset requirements. The enhancement allows for varied data returns, from basic x and y pairs to more complex structures including additional information like background labels. Importantly, this change is backward compatible, ensuring existing datasets continue to function as before.

Changes

  • Enhanced __getitem__ to dynamically handle varying numbers of returned items, enabling support for datasets that return additional data elements or those that simplify to just x and y.
  • Maintained backward compatibility with standard x, y, metadata format datasets, while also facilitating custom datasets with expanded or reduced data structures.

Motivation

The update is motivated by the need for greater flexibility in dataset handling within the WILDS library. A personal use case involved inheriting from WaterbirdsDataset and making it return x, y, s, and metadata. In another scenario, a user might prefer a dataset to return only the features (x) and labels (y), omitting the metadata for a leaner data structure. This change facilitates such customizations by allowing easy adjustments to the return types from dataset classes, without needing to alter the classes directly.

Conclusion

By introducing this backward-compatible enhancement, the WILDS library becomes more adaptable and user-friendly, encouraging contributions and customizations that meet diverse research and application needs.

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.

1 participant