I'm running means2
from scipy, and although I'm getting an error message:
/usr/lib/python2.7/dist-packages/scipy/cluster/vq.py:600: UserWarning: One of the clusters is empty. Re-run kmean with a different initialization. warnings.warn("One of the clusters is empty. "
when running the following code in a loop:
training_2= numpy.random.random_integers(0, 400, size=[50,1]).astype(numpy.float32)
cent, clus= kmeans2(training_2, 3, minit='points')
the loop doesn't terminate. I've noticed this behavior with numpy and OpenCV as well.
The usual try except
block doesn't catch these (for lack of a better term) 'soft' errors; is there another way to handle these errors?
If this isn't possible directly, then is there a way to have a python script read it's own output as it runs?