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 apriori algorithm aprioriGen #15

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

Conversation

cfisher-ai
Copy link

When converting sets to lists, the ordering is non-deterministic.

For example if the input to aprioriGen was: ([{0,1}, {1,2}, {2,0}], 3)
If the lists stay in the same order as the sets appear, no two lists would have the same leading digit.

I think the optimisation only makes sense if you sort the lists first.

@ChaselP
Copy link

ChaselP commented Nov 24, 2019

When converting sets to lists, the ordering is non-deterministic.

For example if the input to aprioriGen was: ([{0,1}, {1,2}, {2,0}], 3)
If the lists stay in the same order as the sets appear, no two lists would have the same leading digit.

I think the optimisation only makes sense if you sort the lists first.

I tried this set [{0,1},{1,2},{2,0}] with python3.6 in PyCharm, I found the set was sorted to [{0,1},{1,2},{0,2}] automaticly. and the set[{0,1,2}] was append to the retList. But sort the lists before compare lists[:k-2] is better than the origin anyway.

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