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

Fix splitter errors for datasets without labels #2641

Merged
merged 6 commits into from
Aug 23, 2021

Conversation

Suzukazole
Copy link
Contributor

Description

Some datasets without labels such as USPTO, Swiss-Prot are not compatible with the splitters as the get_shard_size method looks for the length of y, which in this case is None. This is a crack at getting around this issue, I was able to load in and split the USPTO datasets with this.

Type of change

Please check the option that is related to your PR.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • In this case, we recommend to discuss your modification on GitHub issues before creating the PR
  • Documentations (modification for documents)

Checklist

  • My code follows the style guidelines of this project
    • Run yapf -i <modified file> and check no errors (yapf version must be 0.22.0)
    • Run mypy -p deepchem and check no errors
    • Run flake8 <modified file> --count and check no errors
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

@Suzukazole
Copy link
Contributor Author

@rbharath I feel there might be a better way to do this, but for now this works as intended with the USPTO loader.

w = np.random.randint(2, size=(num_datapoints, num_tasks))
ids = np.array(["id"] * num_datapoints)

dataset = dc.data.DiskDataset.from_numpy(X, y, w, ids)
Copy link
Member

Choose a reason for hiding this comment

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

So here I'm thinking more if we do

dataset = dc.data.DiskDataset.from_numpy(X)
assert dataset.get_shard_size() == 100

The idea is we want to check that datasets without labels work correctly :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup! will add that

Copy link
Member

@rbharath rbharath left a comment

Choose a reason for hiding this comment

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

For some reason I'm not seeing the latest CI run here.

If the CI is passing as expected we can go ahead and merge this PR in. I think code is all good. Let me know if I can merge

deepchem/data/tests/reaction_smiles.csv Show resolved Hide resolved

Note
----
DiskDatasets without labels cannot be resharded!
Copy link
Member

Choose a reason for hiding this comment

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

This should be fixed! Can you raise a separate issue for this and we can get a fix going?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup will do!

@Suzukazole
Copy link
Contributor Author

@rbharath Could you try restarting the checks maybe? I think I opened the PR when github actions was down.

Copy link
Member

@rbharath rbharath left a comment

Choose a reason for hiding this comment

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

Ok I think this is good! Going to merge in

@rbharath rbharath merged commit a8f150e into deepchem:master Aug 23, 2021
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.

2 participants