// In case of an empty cluster, reinitialize with a random point
// from largest cluster.
if sum(membship[old_clust, :]) == 0:
from_clust = membship.sum(axis=1).argmax()
choices = \
[ii for ii, ch in enumerate(membship[from_clust, :]) if ch]
rindx = np.random.choice(choices)
After Change
// In case of an empty cluster, reinitialize with a random point
// from largest cluster.
if not membship[old_clust, :].any():
from_clust = membship.sum(axis=1).argmax()
choices = \
[ii for ii, ch in enumerate(membship[from_clust, :]) if ch]