Loading [MathJax]/jax/input/TeX/config.js
前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >sklearn提供的自带的数据集(make_blobs)

sklearn提供的自带的数据集(make_blobs)

作者头像
周小董
发布于 2019-03-25 02:13:39
发布于 2019-03-25 02:13:39
3.5K02
代码可运行
举报
文章被收录于专栏:python前行者python前行者
运行总次数:2
代码可运行
sklearn 的数据集有好多个种
  • 自带的小数据集(packaged dataset):sklearn.datasets.load_
  • 可在线下载的数据集(Downloaded Dataset):sklearn.datasets.fetch_
  • 计算机生成的数据集(Generated Dataset):sklearn.datasets.make_
  • svmlight/libsvm格式的数据集:sklearn.datasets.load_svmlight_file(…)
  • 从买了data.org在线下载获取的数据集:sklearn.datasets.fetch_mldata(…)
①自带的数据集

其中的自带的小的数据集为:sklearn.datasets.load_

sklearn包含一些不许要下载的toy数据集,见下表:

导入toy数据的方法

介绍

任务

数据规模

load_boston()

加载和返回一个boston房屋价格的数据集

回归

506*13

load_iris([return_X_y])

加载和返回一个鸢尾花数据集

分类

150*4

load_diabetes()

加载和返回一个糖尿病数据集

回归

442*10

load_digits([n_class])

加载和返回一个手写字数据集

分类

1797*64

load_linnerud()

加载和返回健身数据集

多分类

20

这些数据集都可以在官网上查到,以鸢尾花为例,可以在官网上找到demo,http://scikit-learn.org/stable/auto_examples/datasets/plot_iris_dataset.html

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
from sklearn.datasets import load_iris
#加载数据集
iris=load_iris()
iris.keys()  #dict_keys(['target', 'DESCR', 'data', 'target_names', 'feature_names'])
#数据的条数和维数
n_samples,n_features=iris.data.shape
print("Number of sample:",n_samples)  #Number of sample: 150
print("Number of feature",n_features)  #Number of feature 4
#第一个样例
print(iris.data[0])      #[ 5.1  3.5  1.4  0.2]
print(iris.data.shape)    #(150, 4)
print(iris.target.shape)  #(150,)
print(iris.target)
"""
  [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2
  2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
  2 2]


"""
import numpy as np
print(iris.target_names)  #['setosa' 'versicolor' 'virginica']
np.bincount(iris.target)  #[50 50 50]

import matplotlib.pyplot as plt
#以第3个索引为划分依据,x_index的值可以为0123
x_index=3
color=['blue','red','green']
for label,color in zip(range(len(iris.target_names)),color):
    plt.hist(iris.data[iris.target==label,x_index],label=iris.target_names[label],color=color)

plt.xlabel(iris.feature_names[x_index])
plt.legend(loc="Upper right")
plt.show()

#画散点图,第一维的数据作为x轴和第二维的数据作为y轴
x_index=0
y_index=1
colors=['blue','red','green']
for label,color in zip(range(len(iris.target_names)),colors):
    plt.scatter(iris.data[iris.target==label,x_index],
                iris.data[iris.target==label,y_index],
                label=iris.target_names[label],
                c=color)
plt.xlabel(iris.feature_names[x_index])
plt.ylabel(iris.feature_names[y_index])
plt.legend(loc='upper left')
plt.show()

手写数字数据集load_digits():用于多分类任务的数据集

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
from sklearn.datasets import load_digits
digits=load_digits()
print(digits.data.shape)
import matplotlib.pyplot as plt
plt.gray()
plt.matshow(digits.images[0])
plt.show()

from sklearn.datasets import load_digits
digits=load_digits()
digits.keys()
n_samples,n_features=digits.data.shape
print((n_samples,n_features))

print(digits.data.shape)
print(digits.images.shape)

import numpy as np
print(np.all(digits.images.reshape((1797,64))==digits.data))

fig=plt.figure(figsize=(6,6))
fig.subplots_adjust(left=0,right=1,bottom=0,top=1,hspace=0.05,wspace=0.05)
#绘制数字:每张图像8*8像素点
for i in range(64):
    ax=fig.add_subplot(8,8,i+1,xticks=[],yticks=[])
    ax.imshow(digits.images[i],cmap=plt.cm.binary,interpolation='nearest')
    #用目标值标记图像
    ax.text(0,7,str(digits.target[i]))
plt.show()

乳腺癌数据集load-barest-cancer():简单经典的用于二分类任务的数据集

糖尿病数据集:load-diabetes():经典的用于回归认为的数据集,值得注意的是,这10个特征中的每个特征都已经被处理成0均值,方差归一化的特征值,

波士顿房价数据集:load-boston():经典的用于回归任务的数据集

体能训练数据集:load-linnerud():经典的用于多变量回归任务的数据集,其内部包含两个小数据集:Excise是对3个训练变量的20次观测(体重,腰围,脉搏),physiological是对3个生理学变量的20次观测(引体向上,仰卧起坐,立定跳远)

svmlight/libsvm的每一行样本的存放格式:

: : …

这种格式比较适合用来存放稀疏数据,在sklearn中,用scipy sparse CSR矩阵来存放X,用numpy数组来存放Y

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
from sklearn.datasets import load_svmlight_file
x_train,y_train=load_svmlight_file("/path/to/train_dataset.txt","")#如果要加在多个数据的时候,可以用逗号隔开
Sample images

sklearn 带有一组JPEG格式的图片,可用与测试需要2D数据的算法和流程

导入图片数据的方法

介绍

load_sample_images()

导入样本图片,用于加载自带的2个图片

load_sample_image(image_name)

导入单个图片,返回numpy数组,用于加载外部图片

②生成数据集

生成数据集:可以用来分类任务,可以用来回归任务,可以用来聚类任务,用于流形学习的,用于因子分解任务的

用于分类任务和聚类任务的:这些函数产生样本特征向量矩阵以及对应的类别标签集合

make_blobs:多类单标签数据集,为每个类分配一个或多个正太分布的点集

make_classification:多类单标签数据集,为每个类分配一个或多个正太分布的点集,提供了为数据添加噪声的方式,包括维度相关性,无效特征以及冗余特征等

make_gaussian-quantiles:将一个单高斯分布的点集划分为两个数量均等的点集,作为两类

make_hastie-10-2:产生一个相似的二元分类数据集,有10个维度

make_circle和make_moom产生二维二元分类数据集来测试某些算法的性能,可以为数据集添加噪声,可以为二元分类器产生一些球形判决界面的数据

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
#生成多类单标签数据集
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets.samples_generator import make_blobs
center=[[1,1],[-1,-1],[1,-1]]
cluster_std=0.3
X,labels=make_blobs(n_samples=200,centers=center,n_features=2,
                    cluster_std=cluster_std,random_state=0)
print('X.shape',X.shape)
print("labels",set(labels))

unique_lables=set(labels)
colors=plt.cm.Spectral(np.linspace(0,1,len(unique_lables)))
for k,col in zip(unique_lables,colors):
    x_k=X[labels==k]
    plt.plot(x_k[:,0],x_k[:,1],'o',markerfacecolor=col,markeredgecolor="k",
             markersize=14)
plt.title('data by make_blob()')
plt.show()

#生成用于分类的数据集
from sklearn.datasets.samples_generator import make_classification
X,labels=make_classification(n_samples=200,n_features=2,n_redundant=0,n_informative=2,
                             random_state=1,n_clusters_per_class=2)
rng=np.random.RandomState(2)
X+=2*rng.uniform(size=X.shape)

unique_lables=set(labels)
colors=plt.cm.Spectral(np.linspace(0,1,len(unique_lables)))
for k,col in zip(unique_lables,colors):
    x_k=X[labels==k]
    plt.plot(x_k[:,0],x_k[:,1],'o',markerfacecolor=col,markeredgecolor="k",
             markersize=14)
plt.title('data by make_classification()')
plt.show()

#生成球形判决界面的数据
from sklearn.datasets.samples_generator import make_circles
X,labels=make_circles(n_samples=200,noise=0.2,factor=0.2,random_state=1)
print("X.shape:",X.shape)
print("labels:",set(labels))

unique_lables=set(labels)
colors=plt.cm.Spectral(np.linspace(0,1,len(unique_lables)))
for k,col in zip(unique_lables,colors):
    x_k=X[labels==k]
    plt.plot(x_k[:,0],x_k[:,1],'o',markerfacecolor=col,markeredgecolor="k",
             markersize=14)
plt.title('data by make_moons()')
plt.show()
单标签

make_blobs 产生多类数据集,对每个类的中心和标准差有很好的控制

输入参数:

sklearn.datasets.samples_generator.make_blobs(n_samples=100, n_features=2, centers=3, cluster_std=1.0, center_box=(-10.0, 10.0), shuffle=True, random_state=None)

参数

类型

默认

说明

n_samples

int类型

可选参数 (default=100)

总的点数,平均的分到每个clusters中。

n_features

int类型

可选参数 (default=2)

每个样本的特征维度。

centers

int类型 or 聚类中心坐标元组构成的数组类型

可选参数(default=3)

产生的中心点的数量, or 固定中心点位置。

cluster_std

float or floats序列

可选参数 (default=1.0)

clusters的标准差。

center_box

一对floats (min, max)

可选参数 (default=(-10.0, 10.0))

随机产生数据的时候,每个cluster中心的边界。

shuffle

boolean

可选参数 (default=True)

打乱样本。

random_state

int, RandomState对象 or None

可选参数 (default=None)

如果是int,random_state作为随机数产生器的seed; 如果是RandomState对象, random_state是随机数产生器; 如果是None, RandomState 对象是随机数产生器通过np.random.

返回的是:

X:[n_samples,n_features]大小的特征矩阵 y: [n_samples]大小的标签数据矩阵,对应特征矩阵的每一行 例子:

  • 例子:

产生两类样本点,两个聚类中心,坐标是(-3, -3)和(3, 3); 方差是0.5和0.7; 样本点有1000个,每个点维度是2维

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
from sklearn.datasets.samples_generator import make_blobs
centers = [(-3, -3),(3, 3)]
cluster_std = [0.5,0.7]
X,y = make_blobs(n_samples=1000, centers=centers,n_features=2, random_state=0, cluster_std=cluster_std)

%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
plt.style.use('ggplot')
plt.figure(figsize=(20,5));
plt.subplot(1, 2, 1 );
plt.scatter(X[:,0] , X[:,1],  c = y, alpha = 0.7);
plt.subplot(1, 2, 2);
plt.hist(y)
plt.show()

产生3类样本点,3个距离中心,方差分别是0.5,0.7,0.5,样本点2000个

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
from sklearn.datasets.samples_generator import make_blobs
centers = [(-3, -3),(0,0),(3, 3)]
cluster_std = [0.5,0.7,0.5]
X,y = make_blobs(n_samples=2000, centers=centers,n_features=2, random_state=0, cluster_std=cluster_std)

%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
plt.style.use('ggplot')
plt.figure(figsize=(20,5));
plt.subplot(1, 2, 1 );
plt.scatter(X[:,0] , X[:,1],  c = y, alpha = 0.7);
plt.subplot(1, 2, 2);
plt.hist(y)
plt.show()
make_classification:可以在模拟数据中添加噪声

输入参数:

sklearn.datasets.samples_generator.make_classification(n_samples=100, n_features=20, n_informative=2, n_redundant=2, n_repeated=0, n_classes=2, n_clusters_per_class=2, weights=None, flip_y=0.01, class_sep=1.0, hypercube=True, shift=0.0, scale=1.0, shuffle=True, random_state=None)

参数

类型

默认

说明

n_samples

int类型

可选 (default=100)

样本数量.

n_features

int

可选 (default=20)

总的特征数量,是从有信息的数据点,冗余数据点,重复数据点,和特征点-有信息的点-冗余的点-重复点中随机选择的。

n_informative

int

optional (default=2)

informative features数量

n_redundant

int

optional (default=2)

redundant features数量

n_repeated

int

optional (default=0)

duplicated features数量

n_classes

int

optional (default=2)

类别或者标签数量

n_clusters_per_class

int

optional (default=2)

每个class中cluster数量

weights

floats列表 or None

(default=None)

每个类的权重,用于分配样本点

flip_y

float

optional (default=0.01)

随机交换样本的一段

class_sep

float

optional (default=1.0)

The factor multiplying the hypercube dimension.

hypercube

boolean

optional (default=True)

If True the clusters are put on the vertices of a hypercube. If False,the clusters are put on the vertices of a random polytope.

shift

float,array of shape [n_features] or None

optional (default=0.0)

Shift features by the specified value. If None,then features are shifted by a random value drawn in [-class_sep,class_sep].

scale

float array of shape [n_features] or None

optional (default=1.0)

Multiply features by the specified value. If None,then features are scaled by a random value drawn in [1,100]. Note that scaling happens after shifting.

shuffle

boolean

optional (default=True)

Shuffle the samples and the features.

random_state

int,RandomState instance or None

optional (default=None)

If int,random_state is the seed used by the random number generator; If RandomState instance,random_state is the random number generator; If None,the random number generator is the RandomState instance used by np.random.

返回的是:

X : array of shape [n_samples, n_features]; 特征矩阵 y : array of shape [n_samples]:矩阵每一行的整数类型标签

例子:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
from sklearn.datasets.samples_generator import make_classification
X,y = make_classification(n_samples=2000, n_features=10, n_informative=4, n_classes=4, random_state=0)

%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
plt.style.use('ggplot')
plt.figure(figsize=(20,5));
plt.subplot(1, 2, 1 );
plt.scatter(X[:,0] , X[:,1],  c = y, alpha = 0.7);
plt.subplot(1, 2, 2);
plt.hist(y)
plt.show()
make_gaussian_quantiles 产生高斯分布

输入参数:

sklearn.datasets.samples_generator.make_gaussian_quantiles(mean=None, cov=1.0, n_samples=100, n_features=2, n_classes=3, shuffle=True, random_state=None)

参数

类型

默认

说明

mean

array of shape [n_features]

optional (default=None)

The mean of the multi-dimensional normal distribution. If None then use the origin (0, 0, …).

cov

float

optional (default=1.)

The covariance matrix will be this value times the unit matrix. This dataset only produces symmetric normal distributions.

n_samples

int

optional (default=100)

The total number of points equally divided among classes.

n_features

int

optional (default=2)

The number of features for each sample.

n_classes

int

optional (default=3)

The number of classes

shuffle

boolean

optional (default=True)

Shuffle the samples.

random_state

int, RandomState instance or None

optional (default=None)

If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
from sklearn.datasets.samples_generator import make_gaussian_quantiles
X,y = make_gaussian_quantiles(mean=(1,1), cov=1.0, n_samples=1000, n_features=2, n_classes=2, shuffle=True, random_state=None)

%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
plt.style.use('ggplot')
plt.figure(figsize=(20,5));
plt.subplot(1, 2, 1 );
plt.scatter(X[:,0] , X[:,1],  c = y, alpha = 0.7);
plt.subplot(1, 2, 2);
plt.hist(y)
plt.show()
make_hastie_10_2

产生用于二分类的数据。Hastie et al. 2009

输入参数:

参数

类型

默认

说明

n_samples

int

optional (default=12000)

The number of samples.

random_state

int, RandomState instance or None

optional (default=None)

If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.

输出:

X : array of shape [n_samples, 10] 特征矩阵。 y : array of shape [n_samples],对应特征矩阵每一个行的真实值。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
from sklearn.datasets.samples_generator import make_hastie_10_2
X,y = make_hastie_10_2(n_samples=1000, random_state=None)

%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
plt.style.use('ggplot')
plt.figure(figsize=(20,5));
plt.subplot(1, 2, 1 );
plt.scatter(X[:,0] , X[:,1],  c = y, alpha = 0.7);
plt.subplot(1, 2, 2);
plt.hist(y)
plt.show()

参考:https://www.cnblogs.com/nolonely/p/6980160.html https://blog.csdn.net/kevinelstri/article/details/52622960 https://scikit-learn.org/dev/modules/generated/sklearn.datasets.make_blobs.html https://blog.csdn.net/sa14023053/article/details/52086695

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019年03月07日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
(数据科学学习手札21)sklearn.datasets常用功能详解
作为Python中经典的机器学习模块,sklearn围绕着机器学习提供了很多可直接调用的机器学习算法以及很多经典的数据集,本文就对sklearn中专门用来得到已有或自定义数据集的datasets模块进行详细介绍; datasets中的数据集分为很多种,本文介绍几类常用的数据集生成方法,本文总结的所有内容你都可以在sklearn的官网: http://scikit-learn.org/stable/modules/classes.html#module-sklearn.datasets 中找到对应的更加详细
Feffery
2018/04/17
1.3K0
(数据科学学习手札21)sklearn.datasets常用功能详解
sklearn 快速入门教程
  sklearn中包含了大量的优质的数据集,在你学习机器学习的过程中,你可以通过使用这些数据集实现出不同的模型,从而提高你的动手实践能力,同时这个过程也可以加深你对理论知识的理解和把握。(这一步我也亟需加强,一起加油!^-^)
py3study
2020/01/16
7390
sklearn自带的数据集以及生成数据
load_boston([return_X_y]) 加载波士顿房价数据;用于回归问题
西西嘛呦
2020/08/26
1.8K0
sklearn自带的数据集以及生成数据
分别用逻辑回归和决策树实现鸢尾花数据集分类
学习了决策树和逻辑回归的理论知识,决定亲自上手尝试一下。最终导出决策树的决策过程的图片和pdf。逻辑回归部分参考的是用逻辑回归实现鸢尾花数据集分类,感谢原作者xiaoyangerr 注意:要导出为pdf先必须安装graphviz(这是一个软件)并且安装pydotplus这个包,把它的graphviz加入系统的环境变量path,否则会报错 决策树 from sklearn.datasets import load_iris from sklearn import tree from sklearn.mo
Aidol
2020/07/23
1.6K0
分别用逻辑回归和决策树实现鸢尾花数据集分类
A.机器学习入门算法(四): 基于支持向量机的分类预测
本项目链接:https://www.heywhale.com/home/column/64141d6b1c8c8b518ba97dcc
汀丶人工智能
2023/03/24
5830
A.机器学习入门算法(四): 基于支持向量机的分类预测
数据科学和人工智能技术笔记 二、数据准备
波士顿住房数据集 是 20 世纪 70 年代的着名数据集。 它包含506个关于波士顿周边房价的观测。 它通常用于回归示例,包含 15 个特征。
ApacheCN_飞龙
2022/12/02
3600
kmeans算法初步
版权声明:本文为博主原创文章,欢迎转载。 https://blog.csdn.net/chengyuqiang/article/details/88812958
程裕强
2019/07/02
4620
kmeans算法初步
异常检测算法比较
算法:异常检测算法比较是包括Robust covariance、One-Class SVM、Isolation Forest和Local Outlier Factor的参数根据实际数据选择的异常检测的结果比较。
裴来凡
2022/05/29
4330
异常检测算法比较
dython:Python数据建模宝藏库
尽管已经有了scikit-learn、statsmodels、seaborn等非常优秀的数据建模库,但实际数据分析过程中常用到的一些功能场景仍然需要编写数十行以上的代码才能实现。
Feffery
2021/08/18
5980
dython:Python数据建模宝藏库
dataset数据集有哪些_数据集类型
​ sklearn的数据集库datasets提供很多不同的数据集,主要包含以下几大类:
全栈程序员站长
2022/08/03
1.9K0
dataset数据集有哪些_数据集类型
sklearn.model_selection.learning_curve
本文是对scikit-learn.org上函数说明<learning_curve>一文的翻译。 包括其引用的用户手册-learning_curve
悠扬前奏
2022/06/06
5700
sklearn.model_selection.learning_curve
了解 Sklearn 的数据集
学习资料: 相关代码 更多可用数据 网址 今天来看 Sklearn 中的 data sets,很多而且有用,可以用来学习算法模型。 eg: boston 房价, 糖尿病, 数字, Iris 花。
杨熹
2018/04/02
1K0
了解 Sklearn 的数据集
机器学习之KNN最邻近分类算法[通俗易懂]
KNN(K-Nearest Neighbor)最邻近分类算法是数据挖掘分类(classification)技术中最简单的算法之一,其指导思想是”近朱者赤,近墨者黑“,即由你的邻居来推断出你的类别。
全栈程序员站长
2022/08/10
1.3K0
机器学习之KNN最邻近分类算法[通俗易懂]
scikit-learn生成数据集
为了方便用户学习机器学习和数据挖掘的方法,机器学习库scikit-learn的数据集模块sklearn.datasets提供了20个样本生成函数,为分类、聚类、回归、主成分分析等各种机器学习方法生成模拟的样本集。
爱编程的小明
2022/09/05
7730
scikit-learn生成数据集
DBSCAN聚类算法Python实现
DBSCAN是一种基于密度的聚类算法,这类密度聚类算法一般假定类别可以通过样本分布的紧密程度决定。同一类别的样本,他们之间的紧密相连的,也就是说,在该类别任意样本周围不远处一定有同类别的样本存在。
里克贝斯
2021/05/21
2.9K1
DBSCAN聚类算法Python实现
K-means算法
聚类(Clustering)是一种无监督学习(unsupervised learning),简单地说就是把相似的对象归到同一簇中。簇内的对象越相似,聚类的效果越好。
润森
2019/08/29
1.1K0
K-means算法
一文掌握sklearn中的支持向量机
前面两节已经介绍了线性SVC与非线性SVC的分类原理。本节将在理论的基础上,简单介绍下sklearn中的支持向量机是如何实现数据分类的。并参照理论中的概念对应介绍重要参数的含义,以及如何调节参数,使得模型在数据集中得到更高的分数。
数据STUDIO
2021/06/24
2.1K0
sklearn同时运行多个模型并进行可视化
参考:https://blog.csdn.net/qq_34106574/article/details/82016442
西西嘛呦
2020/08/26
1K0
sklearn同时运行多个模型并进行可视化
【优质原创】分享几个Sklearn模块中不为人知又超级好用的API函数
相信对于不少机器学习的爱好者来说,训练模型、验证模型的性能等等用的一般都是sklearn模块中的一些函数方法,今天小编来和大家聊一下该模块中那些不那么为人所知的API,可能知道的人不多,但是十分的好用。
用户6888863
2022/06/08
3880
【优质原创】分享几个Sklearn模块中不为人知又超级好用的API函数
机器学习算法的随机数据生成
    在学习机器学习算法的过程中,我们经常需要数据来验证算法,调试参数。但是找到一组十分合适某种特定算法类型的数据样本却不那么容易。还好numpy, scikit-learn都提供了随机数据生成的功能,我们可以自己生成适合某一种模型的数据,用随机数据来做清洗,归一化,转换,然后选择模型与算法做拟合和预测。下面对scikit-learn和numpy生成数据样本的方法做一个总结。
刘建平Pinard
2018/08/14
1.2K0
机器学习算法的随机数据生成
相关推荐
(数据科学学习手札21)sklearn.datasets常用功能详解
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验