Skip to content

Include is_counts_based in CircularFingerprint eq and hash - #5206

Open
barlowa124 wants to merge 1 commit into
deepchem:masterfrom
barlowa124:fix-cfp-hash-counts-based-5169
Open

barlowa124 wants to merge 1 commit into
deepchem:masterfrom
barlowa124:fix-cfp-hash-counts-based-5169

Conversation

@barlowa124

Copy link
Copy Markdown

Closes #5169.

CircularFingerprint.__eq__ and __hash__ omitted
is_counts_based, even though that flag changes what
_featurize produces. Two featurizers differing only in that flag
then compared equal and hashed the same, so a set collapsed them
into one entry while they produced different features.

The field is now part of both the equality tuple and the hash
tuple, matching the repr.

A new test asserts that bit and counts
featurizers are unequal members of a set, and that identical
configurations still compare equal. The featurization test module is green.

…eepchem#5169)

Featurizers differing only in is_counts_based compared and hashed
equal while producing different features (bit vector vs counts), so
they collapsed to one entry in sets and dicts and silently swapped
features in code that caches featurizers by value.
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.

CircularFingerprint.__eq__/__hash__ ignore is_counts_based, so counts and bit-vector featurizers compare equal and collapse in a set

1 participant