make_swiss_roll#
- sklearn.datasets.make_swiss_roll(n_samples=100, *, noise=0.0, random_state=None, hole=False)[source]#
生成瑞士卷数据集。
在用户指南中阅读更多内容。
经 Stephen Marsland 许可改编自其代码 [1]。
- 参数:
- n_samplesint, default=100
瑞士卷上的样本点数量。
- noisefloat, default=0.0
高斯噪声的标准差。
- random_stateint, RandomState instance or None, default=None
确定数据集创建的随机数生成。传递一个 int 值以在多次函数调用中获得可重现的输出。请参阅词汇表。
- holebool, default=False
如果为 True,则生成带孔的瑞士卷数据集。
- 返回:
- X形状为 (n_samples, 3) 的 ndarray
点。
- t形状为 (n_samples,) 的 ndarray
根据流形中点的主要维度,样本的单变量位置。
注意事项
该算法来自 Marsland [1]。
References
[1] (1,2)S. Marsland,“Machine Learning: An Algorithmic Perspective”,第2版,第6章,2014年。https://homepages.ecs.vuw.ac.nz/~marslast/Code/Ch6/lle.py
示例
>>> 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,)