Sklearn Spectral Clustering error in fit_predict : k must be between 1 and the order of the square input matrix
<p>I'm using <a href="http://scikit-learn.org/stable/modules/generated/sklearn.cluster.SpectralClustering.html" rel="nofollow">Spectral Clustering Library</a> in Python and similarity matrix is its main argument. My matrix looks like:</p>

<pre><code>[[ 1.          0.85018854  0.85091491  0.85717652]
 [ 0.85018854  1.          0.99720197  0.99732831]
 [ 0.85091491  0.99720197  1.          0.9972462 ]
 [ 0.85717652  0.99732831  0.9972462   1.        ]]
</code></pre>

<p>And my code similar to the documentation samples:</p>

<pre><code>cl = SpectralClustering(n_clusters=4,affinity='precomputed')
y = cl.fit_predict(matrix)
</code></pre>

<p>But the following error occurs:</p>

<pre><code>Traceback (most recent call last):
  File "/home/mahmood/PycharmProjects/sentence2vec/graphClustering.py", line 22, in &lt;module&gt;
    y = cl.fit_predict(matrix)
  File "/usr/local/lib/python2.7/dist-packages/scikit_learn-0.17.1-py2.7-linux-x86_64.egg/sklearn/base.py", line 371, in fit_predict
    self.fit(X)
  File "/usr/local/lib/python2.7/dist-packages/scikit_learn-0.17.1-py2.7-linux-x86_64.egg/sklearn/cluster/spectral.py", line 454, in fit
    assign_labels=self.assign_labels)
  File "/usr/local/lib/python2.7/dist-packages/scikit_learn-0.17.1-py2.7-linux-x86_64.egg/sklearn/cluster/spectral.py", line 258, in spectral_clustering
    eigen_tol=eigen_tol, drop_first=False)
  File "/usr/local/lib/python2.7/dist-packages/scikit_learn-0.17.1-py2.7-linux-x86_64.egg/sklearn/manifold/spectral_embedding_.py", line 254, in spectral_embedding
    tol=eigen_tol)
  File "/usr/lib/python2.7/dist-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 1507, in eigsh
    raise ValueError("k must be between 1 and the order of the "
ValueError: k must be between 1 and the order of the square input matrix.
</code></pre>

<p>I have no idea and I need to know what is the problem and maybe it's solution.</p>