Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

ValueError: attempt to get argmin of an empty sequence #2

Open
ShanikaEdiriweera opened this issue Aug 3, 2017 · 2 comments
Open

Comments

@ShanikaEdiriweera
Copy link

ShanikaEdiriweera commented Aug 3, 2017

This error only occurs sometimes.

I think when a cluster size is zero this happens. When trying to get the min of an empty array.
line 29, in kMedoids j = np.argmin(J)

Stack trace -
`F:\Programs\Anaconda3\lib\site-packages\numpy\core_methods.py:59: RuntimeWarning: Mean of empty slice.
warnings.warn("Mean of empty slice.", RuntimeWarning)
Traceback (most recent call last):

File "", line 1, in
runfile('D:/University/FYP/code/fyp_scritps/clustering/phrase_cluster.py', wdir='D:/University/FYP/code/fyp_scritps/clustering')

File "F:\Programs\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile
execfile(filename, namespace)

File "F:\Programs\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "D:/University/FYP/code/fyp_scritps/clustering/phrase_cluster.py", line 43, in
M, C = kmedoids.kMedoids(D, 2)

File "D:\University\FYP\code\fyp_scritps\clustering\kmedoids\kmedoids.py", line 29, in kMedoids
j = np.argmin(J)

File "F:\Programs\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 1033, in argmin
return argmin(axis, out)

File "F:\Programs\Anaconda3\lib\site-packages\numpy\matrixlib\defmatrix.py", line 895, in argmin
return N.ndarray.argmin(self, axis, out)._align(axis)

ValueError: attempt to get argmin of an empty sequence`

@Pked01
Copy link

Pked01 commented Nov 11, 2017

i faced same issue,
its because when all element assigned to other clusters, and because of that some cluster endup with 0 elements. this can be removed by reassigning cluster center randomly
also output of this algo also doesn't remove cluster centers from being part of other clusters,

@TyrandeWhisperwind
Copy link

what is the tmax varaible for? and why did u set it to 100?
if i have a dataset of 800 points should i put tmax=800?

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

No branches or pull requests

3 participants