kmedoids
kmedoids copied to clipboard
ValueError: attempt to get argmin of an empty sequence
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 "
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
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`
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,
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?