Skip to content

fix apriori algorithm aprioriGen#15

Open
cfisher-ai wants to merge 1 commit intopbharrin:masterfrom
cfisher-ai:master
Open

fix apriori algorithm aprioriGen#15
cfisher-ai wants to merge 1 commit intopbharrin:masterfrom
cfisher-ai:master

Conversation

@cfisher-ai
Copy link
Copy Markdown

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
Copy Markdown

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