0

Every time I run a tensorflow file on terminal, this warning pops up before the file runs. I have checked my version of sklearn and it is 0.18.1. How do you make this message to not appear? Thank you.

anaconda2/envs/tensorflow/lib/python2.7/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20. "This module will be removed in 0.20.", DeprecationWarning)

HYUN JAE CHO
  • 169
  • 1
  • 1
  • 8

1 Answers1

1

It is not an error message, it is simply a warning that a module cross_validation has been transmitted from sklearn.cross_validation to sklearn.model_selection.. It is not a problem at all.

If you are still eager to fix it, then you should find out what snippet of code tries to import sklearn.cross_validation and alter it to sklearn.model_selection.


If you check both sklearn.cross_validation and sklearn.model_selection, you will see that they contain the same methods. Again, it is not an error.

E.Z
  • 1,958
  • 1
  • 18
  • 27
  • I understand that. I called it a warning in my question, mistakenly called it an error in the title. Do you happen to know the snippet of code to fix it? It's kind of annoying to see it every time I run it.. – HYUN JAE CHO Jun 27 '17 at 14:57
  • Okay. You either do it [explicitly](https://stackoverflow.com/questions/32612180/eliminating-warnings-from-scikit-learn) or implicitly, i.e. change the incorrect `import` in one of the imported *TensorFlow* modules that provokes the warning to pop up. – E.Z Jun 27 '17 at 15:04
  • Thanks. I'm just curious why this suddenly appears. I used to not have this warning. Due to another error, I uninstalled and reinstalled tensorflow and this started to appear after that. The only import I'm doing is import tensorflow as tf. I'm not importing sklearn. I wonder if there's a way to fix it permanently without needing to do either the explicit or the implicit methods you mentioned.. – HYUN JAE CHO Jun 27 '17 at 15:13
  • If you only import *TensorFlow* and this warning pops up, it means that `import sklearn.cross_validation` is written in one (or bunch) of *TensorFlow* modules. So by implicitly fixing the problem, I mean to change that code line to the appropriate one in the according module(s). There is no other to fix the problem, besides the explicit approach. Or you could always wait until *TensorFlow* is updated to a new version where this `import` is fixed. – E.Z Jun 27 '17 at 15:19