You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've taken the code from the pbharrin/machinelearninginaction3x github repo so it shouldn't be down to typos. I've run the code line by line outside of the function and I get the same error at the same point when I try to run the for loop. I'm not an experienced Python coder so it's a bit beyond me to try and solve this myself. I'm loving the book so far though.
The text was updated successfully, but these errors were encountered:
Can you please check the type of voteIlabel? It should not be a list.
You can check the type by adding print(type(voteIlabel)) after line 10 inside the for loop.
There may be some conversion that was done automatically in Python 2 but not Python 3.
I'm getting an error with the classify0() function in the kNN.py module.
---> 11 classCount[voteIlabel] = classCount.get(voteIlabel, 0) + 1
12 sortedClassCount = sorted(classCount.items(), key=operator.itemgetter(1), reverse=True)
13 return sortedClassCount[0][0]
TypeError: unhashable type: 'list'
I've taken the code from the pbharrin/machinelearninginaction3x github repo so it shouldn't be down to typos. I've run the code line by line outside of the function and I get the same error at the same point when I try to run the for loop. I'm not an experienced Python coder so it's a bit beyond me to try and solve this myself. I'm loving the book so far though.
The text was updated successfully, but these errors were encountered: