manifold.Isomap(n_neighbors, n_components).fit_transform - SciKit Learn
<p>I have a dataframe called X_train and I am performing Isomap dimensionality reduction using SciKit Learn.  The code is the following:</p>

<pre><code> from sklearn import manifold
 iso = manifold.Isomap(n_neighbors=4, n_components=2)
 iso.fit(X_train)
 manifold.Isomap(eigen_solver='auto', max_iter=None, n_components=2,  n_neighbors=4,neighbors_algorithm='auto', path_method='auto', tol=0)
 X2_train = manifold.Isomap(n_neighbors,  n_components).fit_transform(X_train)
</code></pre>

<p>I am getting an errror message:</p>

<pre><code>  Traceback (most recent call last):
  File "&lt;ipython-input-133-12f224bb5f59&gt;", line 1, in &lt;module&gt;
  X2_train = manifold.Isomap(n_neighbors,  n_components).fit_transform(X_train)
  NameError: name 'n_neighbors' is not defined
</code></pre>

<p>What am I doing wrong?  Could you help me?  Thank you!</p>

<p>It raises this error because you did not create any variables called <code>n_neighbors</code> nor <code>n_components</code>. </p>

<p>As for the variable <code>iso</code>, you have to indicate the values of your parameters.<code>Isomap(n_neighbors=4, n_components=2)</code></p>

<p>Try this out :</p>

<pre><code>X2_train = manifold.Isomap(n_neighbors=4, n_components=2).fit_transform(X_train)
</code></pre>

python scikit-learn