:::| 目前位置圖示目前位置:首頁圖示回首頁 | 主功能頁圖示相關問答
sklearn/cross_validation.py:44: DeprecationWarning:

[日期]:2018/05/26  [瀏覽人數]:506

執行:

from sklearn.model_selection import train_test_split
# random_state: the seed used by the random number generator
X_train, X_test, y_train, y_test = train_test_split(
         X, y, test_size=0.3, random_state=0)

出現錯誤:

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)

[sklearn.cross_validation]

模塊在0.18版本中被棄用,支持所有重構的類和函數都被移動到的model_selection模塊

所以請將from sklearn.model_selection import train_test_split

置換成from sklearn.model_selection import train_test_split

就可解決該錯誤訊息