栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

sklearn中三种常见的数据集的演示(波士顿房价数据集、鸢尾花数据集、手写数字数据集)

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

sklearn中三种常见的数据集的演示(波士顿房价数据集、鸢尾花数据集、手写数字数据集)

1.波士顿房价数据集

from sklearn.datasets import load_boston
boston = load_boston()
print(boston.data.shape)

from sklearn.datasets import load_boston
data, target = load_boston(return_X_y=True)
print(data.shape)
print(target.shape)#target就是价格 data即属性

2.鸢尾花数据集

#鸢尾花数据集演示
from sklearn.datasets import load_iris
iris = load_iris()
print(iris.data.shape)
print(iris.target.shape)
print(list(iris.target_names))

3.手写数字数据集

#手写数字数据集演示
#手写数字数据集包括1797个0-9的手写数字数据,每个数字由8*8大小的矩阵构成,矩阵中值的范围是0-16,代表颜色的深度。
from sklearn.datasets import load_digits
digits = load_digits()
print(digits.data.shape)
print(digits.target.shape)
print(digits.images.shape)
import matplotlib.pyplot as plt
plt.matshow(digits.images[641])
plt.show()
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/307700.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号