I am just playing around encoding and decoding but I get this error from sklearn:
Warning (from warnings module): File \"C:\\Python36\\lib\\site-packa
TLDR: You can ignore the warning. It is caused by sklearn doing something internally that is not quite ideal.
The warning is actually caused by numpy
, which deprecated truth testing on empty arrays:
The long and short is that truth-testing on empty arrays is dangerous, misleading, and not in any way useful, and should be deprecated.
This means one is not supposed to do something like if array:
to check if array
is empty. However, sklearn does this in the 0.19.1 release:
diff = np.setdiff1d(y, np.arange(len(self.classes_)))
if diff:
raise ValueError("y contains new labels: %s" % str(diff))
Because your version of numpy is recent enough it complains and issues a warning.
The problem has been fixed in sklearn's current master branch, so I'd expect the fix to be included in the next release.
After updated numpy, the warning was cleared away:
conda update numpy
You can also update it by pip or something else.