pyclust icon indicating copy to clipboard operation
pyclust copied to clipboard

Looking for more clusters returns a `ValueError`

Open nikanar opened this issue 7 years ago • 2 comments

I run kmedoids with (abridged) :

    k = 30
    kmd = pyclust.KMedoids(n_clusters=k, n_trials=10)
    kmd.fit(data) # data is 10k points in dim 100, word representations

And all goes fine with k = 30, but running the same with k = 100 gives :

Traceback (most recent call last): 
[...]
    kmd.fit(data)
  File "/home/will/.local/lib/python3.6/site-packages/pyclust/_kmedoids.py", line 131, in fit
    _kmedoids(X, self.n_clusters, self.distance, self.max_iter, self.n_trials, self.tol)
  File "/home/will/.local/lib/python3.6/site-packages/pyclust/_kmedoids.py", line 62, in _kmedoids
    _kmedoids_run(X, n_clusters, distance, max_iter, tol)
  File "/home/will/.local/lib/python3.6/site-packages/pyclust/_kmedoids.py", line 42, in _kmedoids_run
    centers,sse_arr = _update_centers(X, membs, n_clusters, distance)
  File "/home/will/.local/lib/python3.6/site-packages/pyclust/_kmedoids.py", line 24, in _update_centers
    inx_min = np.argmin(dist)
  File "/usr/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 1033, in argmin
    return argmin(axis, out)
ValueError: attempt to get argmin of an empty sequence

Would you know why / what happens ?

nikanar avatar Jan 29 '17 10:01 nikanar

I have the same problem, in my case with 2 clusters I have the error

C:\Program

Files\Anaconda2\lib\site-packages\numpy\core\fromnumeric.pyc in argmin(a, axis, out) 1032 except AttributeError: 1033 return _wrapit(a, 'argmin', axis, out) -> 1034 return argmin(axis, out) 1035 1036

ValueError: attempt to get argmin of an empty sequence

puxama avatar Feb 27 '17 22:02 puxama

I got the same error for some data but for others it was working fine. You guys got any sol. @nikanar @puxama @mirjalil

rremani avatar Jul 22 '17 11:07 rremani