I am trying to learn an a priori computer learning algorithm from a book that uses Python, and as part of this tutorial, I currently adhere to this following problem:
The following code construct works fine:
Ck = [[1], [2], [3], [4], [5]] for tranid in range(10): for candidate in Ck: print("Printing candidate value: ", candidate)
However, the following does not work:
Ck = [[1], [2], [3], [4], [5]] Ck2 = map(frozenset, Ck) for tranid in range(10): for candidate in Ck2: print("Printing candidate value: ", candidate)
When I match each element of my original iterable using frozenset, I notice that the inner loop ("for candidate Ck2") runs only once. After that, it is never executed. The code above without a phenisometer properly goes through the internal circuit 10 times. However, with frozenset display, I can get the inner loop to execute only once.
Please help me with this. The book displays iterable values ββin frozenset because they do not want it to be volatile for algorithm purposes. I'm just trying to follow it as it is.
I am using Python 3.5.1 on Anaconda (Spyder).
Please help as I am new to Python and Machine Learning.
Thanks and respect, Mahesh.