zoukankan      html  css  js  c++  java
  • scikit-learn 0.18中的cross_validation模块被移除

    环境:scikit-learn 0.18 , python3

    from sklearn.cross_validation import train_test_split 
    from sklearn.grid_search import GridSearchCV 

    报出如下警告:

    from sklearn.grid_search import GridSearchCV 
    /usr/lib/python3.4/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) 
    /usr/lib/python3.4/site-packages/sklearn/grid_search.py:43: 
    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. This module will be removed in 0.20. 
    DeprecationWarning) from sklearn.cross_validation import 
    train_test_split 
    /usr/lib/python3.4/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)

    解决方法:

    该模块在0.18版本中被弃用,支持所有重构的类和函数都被移动到的model_selection模块

    from sklearn.model_selection import GridSearchCV
    
    from sklearn.model_selection import train_test_split

    警告

    DeprecationWarning) 
    /usr/lib/python3.4/site-packages/sklearn/utils/validation.py:395: 
    DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 
    and will raise ValueError in 0.19. Reshape your data either using 
    X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) 
    if it contains a single sample.

    解决方法

    clf.predict([]) 规范输入

  • 相关阅读:
    Docker 第一篇 认识Docker 的作用好处
    AspNetCoreApi 跨域处理
    VS 2017 发布:由于构建错误,发布失败
    iTerm2 cheatsheet (from github)
    find命令:忽略一个目录或者多个目录
    git push throws error: RPC failed; result=22, HTTP code = 411的解决办法
    sourceTree 一款图形化GIT工具
    生产力工具之vimwiki 和 calendar
    source : not found 原因及解决办法
    亚马逊开放机器学习系统源代码:挑战谷歌TensorFlow
  • 原文地址:https://www.cnblogs.com/tan2810/p/10595491.html
Copyright © 2011-2022 走看看