make_swiss_roll#

sklearn.datasets.make_swiss_roll(n_samples=100, *, noise=0.0, random_state=None, hole=False)#

生成一个瑞士卷数据集。

更多信息请参阅 用户指南

Parameters:
n_samplesint, default=100

瑞士卷上的样本点数量。

noisefloat, default=0.0

高斯噪声的标准差。

random_stateint, RandomState 实例或 None, default=None

确定用于数据集创建的随机数生成。为多个函数调用传递一个 int 以获得可重现的输出。 请参阅 术语表

holebool, default=False

如果为 True,生成带孔的瑞士卷数据集。

Returns:
Xndarray of shape (n_samples, 3)

点。

tndarray of shape (n_samples,)

样本在流形中主要维度上的单变量位置。

Notes

该算法来自 Marsland [1]。

References

[1]

S. Marsland, “Machine Learning: An Algorithmic Perspective”, 第二版, 第6章, 2014年。 https://homepages.ecs.vuw.ac.nz/~marslast/Code/Ch6/lle.py

Examples

>>> from sklearn.datasets import make_swiss_roll
>>> X, t = make_swiss_roll(noise=0.05, random_state=0)
>>> X.shape
(100, 3)
>>> t.shape
(100,)