环境: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([]) 规范输入

scikit-learn 0.18中的cross_validation模块被移除的更多相关文章

  1. Scikit Learn: 在python中机器学习

    转自:http://my.oschina.net/u/175377/blog/84420#OSC_h2_23 Scikit Learn: 在python中机器学习 Warning 警告:有些没能理解的 ...

  2. 【numpy】新版本中numpy(numpy>1.17.0)中的random模块

    numpy是Python中经常要使用的一个库,而其中的random模块经常用来生成一些数组,本文接下来将介绍numpy中random模块的一些使用方法. 首先查看numpy的版本: import nu ...

  3. 三分钟快速上手TensorFlow 2.0 (中)——常用模块和模型的部署

    本文学习笔记参照来源:https://tf.wiki/zh/basic/basic.html 前文:三分钟快速上手TensorFlow 2.0 (上)——前置基础.模型建立与可视化 tf.train. ...

  4. scikit learn 模块 调参 pipeline+girdsearch 数据举例:文档分类 (python代码)

    scikit learn 模块 调参 pipeline+girdsearch 数据举例:文档分类数据集 fetch_20newsgroups #-*- coding: UTF-8 -*- import ...

  5. sklearn.cross_validation 0.18版本废弃警告及解决方法

    转载:cheneyshark 机器环境: scikit-learn==0.19.1 Python 2.7.13 train_test_split基本用法 在机器学习中,我们通常将原始数据按照比例分割为 ...

  6. 在阿里云Centos7.6中部署nginx1.16+uwsgi2.0.18+Django2.0.4

    上次在网上找了一个在阿里云Centos7.6中部署nginx1.16+uwsgi2.0.18+Django2.0.4的文档,可能是这个文档不是最新版的,安装的时候遇到了很多问题, 最后跟一个大神要了一 ...

  7. (原创)(四)机器学习笔记之Scikit Learn的Logistic回归初探

    目录 5.3 使用LogisticRegressionCV进行正则化的 Logistic Regression 参数调优 一.Scikit Learn中有关logistics回归函数的介绍 1. 交叉 ...

  8. (原创)(三)机器学习笔记之Scikit Learn的线性回归模型初探

    一.Scikit Learn中使用estimator三部曲 1. 构造estimator 2. 训练模型:fit 3. 利用模型进行预测:predict 二.模型评价 模型训练好后,度量模型拟合效果的 ...

  9. Python中的random模块,来自于Capricorn的实验室

    Python中的random模块用于生成随机数.下面介绍一下random模块中最常用的几个函数. random.random random.random()用于生成一个0到1的随机符点数: 0 < ...

随机推荐

  1. 如何在localStorage中存取数组

    默认localStorage只能存取字符串 那么如何存取数组呢 let newlist = [] localStorage.setItem('recent', JSON.stringify(newli ...

  2. Angular7教程-03-Angular常用操作(上)

    本节来介绍angular中的操作以及TypeScript语法的简单介绍.关于TypeScript语法的更为详细的内容,打算在整个angular教程结束后再单独介绍. 0. 安装所需要的插件及配置插件 ...

  3. 改变eclipse左侧目录数字体大小

    不可在eclipse中修改,只能通过修改配置文件来实现. 找到eclipse的安装位置(或解压路径): eclipse\plugins\org.eclipse.ui.themes_1.2.100.v2 ...

  4. mysql 5.7 或以上版本 group by 问题记录

    mysql 5.7或以上的新版本sql_mode 默认开启开 ONLY_FULL_GROUP_BY,如果 select 中出现的字段,没有使用聚合函数,或不存在group by中就会提示,this i ...

  5. 使用VMware安装CentOS7

    以前一直用的CentOS6,这次搭建一套CentOS7. 感觉和6还是有一些差异,在这边记录下. 一.选择典型(推荐): 二.选择安装程序光盘映像文件: 网上有几个版本,mini版,DVD版,不过mi ...

  6. 使用echart的雷达图的时候,如果文字越界的解决办法记录,标签文字自动换行

    使用echart的雷达图的时候,如果文字越界的解决办法记录,标签文字自动换行 前几天项目中有一个图表的是用echart生成的,遇到一个问题,就是在手机端显示的售时候,如果文字太长就会超出div,之前的 ...

  7. scala爬取指定地点的所有列车班次

    需求介绍: 爬取指定地点的所有全国相关的列车班次详情.将结果写进mysql. 步骤及所遇到的问题: 1.寻取全国站点静态信息   https://kyfw.12306.cn/otn/resources ...

  8. espcomm_send_command: didn't receive command response | espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed |arduino wemos d1 无法上传

    espcomm_send_command: didn't receive command response espcomm_send_command(FLASH_DOWNLOAD_BEGIN) fai ...

  9. 网易云易盾CTO朱浩齐:我们是如何用AI赋能内容安全?

    本文由  网易云发布. 5月19日,LiveVideoStack携手网易云易盾,共同打造了“娱乐多媒体开发应用实践”专题,帮助开发者和泛娱乐平台运营人员,提升技术能力,突破难点,拓展思路与视野. 在专 ...

  10. Go语言反射之值反射

    1 概述 反射不仅可以获取值的类型信息,还可操作变量的值.使用 reflect.Value 类型操作变量的值. 2 值反射对象 reflect.ValueOf() 方法可以获取一个值的反射对象,之后可 ...