数据的分类和介绍
一.数据的划分
实例:
#!/usr/bin/env python # -*- coding: utf-8 -*- #author tom from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split li=load_iris() print("获取特征值") print(li.data) print('获取目标值') print(li.target) print('描述') print(li.DESCR) #注意返回值 训练集 trian x_trian,y_trian 测试集 test x_test y_test # x_trian,x_test,y_trian,y_test=train_test_split(li.data,li.target,test_size=0.25) # print('训练集的特征值和目标值',x_trian,y_trian) # print('测试集的特征值和目标值',x_test,y_test)
from sklearn.datasets import load_iris,fetch_20newsgroups,load_boston
#获取大数据集 news=fetch_20newsgroups(subset='all') print('news===',news.data) print('news-target',news.target) # lb=load_boston() print("获取特征值") print(lb.data) print('获取目标值') print(lb.target) print('描述') print(lb.DESCR)