0

I am trying to reproduce and understand the code included in this document on Laplacian Eigenmaps for Dimensionality Reduction using Google Colab. However, I am getting the following error:

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'

I have made sure that I can actually display the plots in the collection (Swiss roll) by calling additional functions, but it still does not work. Likewise, this answer suggested by Google Colab does not help.

Here is the relevant code:

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)
desertnaut
  • 57,590
  • 26
  • 140
  • 166
Antoni Parellada
  • 4,253
  • 6
  • 49
  • 114
  • Welcome to SO; please notice that it does *not* work by throwing all our code in a question as is - see how to create a [mcve]. Plus, question has nothing to do with `matplotlib` or `google-colaboratory` - kindly do not spam irrelevant tags (edited). – desertnaut Apr 06 '21 at 16:22

1 Answers1

1

There is no module named as samples_generator in latest versions of skicit-learn. So just write

S_curve, S_colors = datasets.make_s_curve(n_points, random_state=0)
rupinderg00
  • 189
  • 8