-
Notifications
You must be signed in to change notification settings - Fork 876
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
Fpmax #553
Fpmax #553
Conversation
s = ('The allowed values for a DataFrame' | ||
' are True, False, 0, 1. Found value %s' % (val)) | ||
raise ValueError(s) | ||
idxs = np.where((df.values != 1) & (df.values != 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know if that captures True
and False
values as well by chance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, in python, 1 == True (==1.0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha, right, seems like my basic Python skill are getting a tad rusty
Again, thanks so much for this very nice PR! I can take care of the documentation part. |
Ok, cool, thanks! |
BTW, one design decision to discuss regarding max_len. It's not quite so clear what to do with max_len for this problem, where you are enumerating maximal itemsets. There are two options:
The latter is including max_len in the maximality constraint. For example, if {a,b,c,d} and {c,d,e} are maximal itemsets. If you user gives a max_len of 3 the options would return:
I chose to go with the former, option (1), because with option (2) you can return itemsets that are not maximal wrt to the complete database. In other words, option (1) gives you subset of the complete set of solutions. The other way would be fairly easy to implement as well, so if you think it's better, we can do it. |
Good point. I think there would be edge cases where someone would prefer one over the other. However, when I think of maximal itemsets, intuitively, I would think about it wrt the complete database as in scenario 1. I'd say we should go with 1, like you also suggest. |
Regarding what's currently implemented ... looking at the code (
|
Yep, option 1. |
Once the unit tests pass, I think this should be good to merge. Thanks a lot once again. Looks like quite some effort went into the code, and I particularly like the engineering best-practices regarding refactoring and encapsulation. |
Description
Added FPMax algorithm to frequent pattern mining. FPMax find maximal itemsets.
Related issues or pull requests
Related to #509
Pull Request Checklist
./docs/sources/CHANGELOG.md
file (if applicable)./mlxtend/*/tests
directories (if applicable)mlxtend/docs/sources/
(if applicable)PYTHONPATH='.' pytest ./mlxtend -sv
and make sure that all unit tests pass (for small modifications, it might be sufficient to only run the specific test file, e.g.,PYTHONPATH='.' pytest ./mlxtend/classifier/tests/test_stacking_cv_classifier.py -sv
)flake8 ./mlxtend