当我从cross_validation
导入sklearn
时:
from sklearn import cross_validation
我收到以下错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'cross_validation' from 'sklearn' (/root/anaconda3/lib/python3.7/site-packages/sklearn/__init__.py)
答案 0 :(得分:3)
您必须将其称为
#if defined(__GNUC__)
#define PRAGMA(x) _Pragma(#x)
#define COMP_MSG(msg)\
PRAGMA(message msg)
#elif defined(__ARMCC_VERSION)
// need code here
#endif
COMP_MSG("WARNING")
如果要进行train test splitting
,则需要提供以下内容from sklearn.model_selection import cross_validate
sklearn中的交叉验证火车测试拆分已弃用
from sklearn.model_selection import train_test_split
a_train, a_test, b_train, b_test = train_test_split(a, b,
test_size=0.33, random_state=42)