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([]) 规范输入
scikit-learn 0.18中的cross_validation模块被移除的更多相关文章
- Scikit Learn: 在python中机器学习
转自:http://my.oschina.net/u/175377/blog/84420#OSC_h2_23 Scikit Learn: 在python中机器学习 Warning 警告:有些没能理解的 ...
- 【numpy】新版本中numpy(numpy>1.17.0)中的random模块
numpy是Python中经常要使用的一个库,而其中的random模块经常用来生成一些数组,本文接下来将介绍numpy中random模块的一些使用方法. 首先查看numpy的版本: import nu ...
- 三分钟快速上手TensorFlow 2.0 (中)——常用模块和模型的部署
本文学习笔记参照来源:https://tf.wiki/zh/basic/basic.html 前文:三分钟快速上手TensorFlow 2.0 (上)——前置基础.模型建立与可视化 tf.train. ...
- scikit learn 模块 调参 pipeline+girdsearch 数据举例:文档分类 (python代码)
scikit learn 模块 调参 pipeline+girdsearch 数据举例:文档分类数据集 fetch_20newsgroups #-*- coding: UTF-8 -*- import ...
- sklearn.cross_validation 0.18版本废弃警告及解决方法
转载:cheneyshark 机器环境: scikit-learn==0.19.1 Python 2.7.13 train_test_split基本用法 在机器学习中,我们通常将原始数据按照比例分割为 ...
- 在阿里云Centos7.6中部署nginx1.16+uwsgi2.0.18+Django2.0.4
上次在网上找了一个在阿里云Centos7.6中部署nginx1.16+uwsgi2.0.18+Django2.0.4的文档,可能是这个文档不是最新版的,安装的时候遇到了很多问题, 最后跟一个大神要了一 ...
- (原创)(四)机器学习笔记之Scikit Learn的Logistic回归初探
目录 5.3 使用LogisticRegressionCV进行正则化的 Logistic Regression 参数调优 一.Scikit Learn中有关logistics回归函数的介绍 1. 交叉 ...
- (原创)(三)机器学习笔记之Scikit Learn的线性回归模型初探
一.Scikit Learn中使用estimator三部曲 1. 构造estimator 2. 训练模型:fit 3. 利用模型进行预测:predict 二.模型评价 模型训练好后,度量模型拟合效果的 ...
- Python中的random模块,来自于Capricorn的实验室
Python中的random模块用于生成随机数.下面介绍一下random模块中最常用的几个函数. random.random random.random()用于生成一个0到1的随机符点数: 0 < ...
随机推荐
- iOS开发--MQTT实时处理数据
一. MQTT 一个物联网项目中用到了MQTT协议, 可以用来做设备与软件之间的互通. MQTT: 即时通讯协议, 传输层协议 二. 常用: 1.MQTTKit(已经不维护了) 2.MQTTClien ...
- c++学习笔记(新手学习笔记,如有错误请与作者联系)
逗号”,“运算符:a = 公式1,公式2:把公式1的结果放进公式2中进行运算,如: a = 3*5 , a*4; 计算结果:a = 3*5*4=60; typedef:类型别名,为已有类型另外命名 t ...
- MySQL数据查询(重点)
1.查询所有列 * 为所有列 select * from table_name; 2.查询指定列 select id,age from table_name; 3.查询时添加常量列-------本 ...
- python里的默认参数
def extendList(val, test=[]): test.append(val) return test list1 = extendList(10) list2 = extendList ...
- redis学习笔记(三)
Spring data redis: 要求: Redis 版本 > 2.6 与 Lettuce 或 Jedis 集成,两种java开源Redis库. Spring redis主要做的两件事: 连 ...
- vue-nuxt.js部署到宝塔主机服务器
废话不多说,直接上步骤,如下: 本文章为在 vue环境下使用了nuxt.js 1.搭建环境--由于本人安装的是宝塔主机,因此如下: 由于我直接使用的是宝塔主机,直接去“软件管理”安装 PM2管理器. ...
- 通过SSH服务登陆linux服务器(版本RHEL7)
通过SSH服务登陆linux服务器(版本RHEL7) SSH服务概述:是一种能够以安全的方式提供远程登陆的协议,也是目前远程管理linux系统的首选方式.在此之前,我们一般使用FTP或者telnet来 ...
- 【非原创】ISBN码
#include<stdio.h>int main(void){ char a[14],mod[12]="0123456789X"; #include <stdi ...
- 【 C 】高级字符串查找之查找标记(token)函数 strtok介绍
我的csdn博客 一个字符串常常包含几个单独的部分,它们彼此被分隔开来.每次为了处理这些部分,你首先必须把它们从字符串中抽取出来. 这个任务有#include<string.h>中的str ...
- python--基本类型之元组
tuple(元组): 定义和创建和作用: 元组--只读列表,只可以被查询,不能被修改.所以,列表的切片操作同样适用与元组. 元组写在小括号(())里,元素之间用逗号隔开. 虽然元组的元素不可改变,但他 ...