Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: more samples requested than data #13

Open
nahgnaw opened this issue Nov 10, 2015 · 0 comments
Open

RuntimeError: more samples requested than data #13

nahgnaw opened this issue Nov 10, 2015 · 0 comments

Comments

@nahgnaw
Copy link

nahgnaw commented Nov 10, 2015

I have the following simple test code:

from pyxmeans import XMeans as xmeans
import numpy as np

data = np.array([
    [1.0, 1.0],
    [1.1, 1.1],
    [1.2, 1.2],
    [10.0, 10.0],
    [10.1, 10.1],
    [10.2, 10.2]
])

test = xmeans(2)
test.fit(data)

The output reported the following error:

/usr/local/lib/python2.7/dist-packages/pyxmeans/xmeans.py:135: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if centroids in ('kmeans++', 'random'):
/usr/local/lib/python2.7/dist-packages/pyxmeans/mini_batch.py:109: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if self.init == 'random':
/usr/local/lib/python2.7/dist-packages/pyxmeans/mini_batch.py:111: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  elif self.init == 'kmeans++':
Traceback (most recent call last):
  File "test.py", line 14, in <module>
    test.fit(data)
  File "/usr/local/lib/python2.7/dist-packages/pyxmeans/xmeans.py", line 61, in fit
    test_model = self._fit(2, points, np.asarray([new_point1, new_point2]))
  File "/usr/local/lib/python2.7/dist-packages/pyxmeans/xmeans.py", line 146, in _fit
    ).fit(data[:])
  File "/usr/local/lib/python2.7/dist-packages/pyxmeans/mini_batch.py", line 131, in fit
    self.cluster_centers_ =  _minibatch.minibatch(data, self.cluster_centers_, self.n_samples, self.max_iter, self.bic_termination, self.reassignment_ratio)
RuntimeError: more samples requested than data.

Do you know what might be the reason for this error?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant