【发布时间】:2021-07-02 10:32:19
【问题描述】:
我正在尝试使用 Google Colab 在Laplacian Eigenmaps for Dimensionality Reduction 上重现和理解本文档中包含的代码。但是,我收到以下错误:
AttributeError Traceback (most recent call last)
<ipython-input-8-c1726617ad98> in <module>()
3
4 # Get the data and color map.
----> 5 S_curve, S_colors = datasets.samples_generator.make_s_curve(n_points, random_state=0)
6
7 Axes3D
AttributeError: module 'sklearn.datasets' has no attribute 'samples_generator'
我已经确保我可以通过调用附加函数来实际显示the collection(瑞士卷)中的图,但它仍然不起作用。同样,Google Colab 建议的 this answer 也无济于事。
以下是相关代码:
from sklearn import datasets
# Define the number of points to consider.
n_points = 3000
# Get the data and color map.
S_curve, S_colors = datasets.samples_generator.make_s_curve(n_points, random_state=0)
【问题讨论】:
-
欢迎来到 SO;请注意,通过将我们所有的代码按原样抛出问题,它确实不起作用-请参阅如何创建minimal reproducible example。另外,问题与
matplotlib或google-colaboratory无关 - 请不要向无关标签发送垃圾邮件(已编辑)。
标签: python scikit-learn