Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #1
Why the bug occurs
The
ParallelEpisode
class is unhashable because it does not implement the__hash__
and__eq__
methods. This causes aTypeError
when attempting to add instances ofParallelEpisode
to a set or use them as dictionary keys in therecognize_candidate_parallel
function.How to reproduce
WINEPI
library on your own dataset.w.discover_frequent_episodes()
orw.generate_rules()
.README.md
, which triggers the following error:How to fix
Implement the
__hash__
and__eq__
methods in theParallelEpisode
class to make its instances hashable. This allows instances to be added to sets and used as dictionary keys without raising aTypeError
. Here's a step-by-step approach:__eq__
Method: Ensure that twoParallelEpisode
instances are considered equal if their relevant attributes are equal.__hash__
Method: Compute a hash value based on the same attributes used in the__eq__
method.recognize_candidate_parallel
Function: Ensure that the function correctly utilizes the hashableParallelEpisode
instances.This fix will allow the
WINEPI
functions to work as expected without encountering hash-related errors.Test these changes locally