从别人那fork来的机器学习程序,跑的时候报错
Traceback (most recent call last):
File "<ipython-input-1-bce2f004f2e1>", line 1, in <module>
runfile('xxx/xxx.py', wdir='xxx')
File "d:\program\python\python3.7\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)
File "d:\program\python\python3.7\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "xxx/xxx.py", line 2, in <module>
from sklearn.cross_validation import train_test_split
ModuleNotFoundError: No module named 'sklearn.cross_validation'
查了一下,新版的cross_validation改了
#原来的验证器
#from sklearn.cross_validation import train_test_split
#新验证器
from sklearn.model_selection import KFold
from sklearn.model_selection import train_test_split
修改后搞定。