DEC-Keras
DEC-Keras copied to clipboard
Wrong ending condition
Hi, thanks for sharing your code. It is very helpful. However, I thought I found an error in keras_dec.py:
delta_label = ((y_pred == self.y_pred).sum().astype(np.float32) / y_pred.shape[0])
if y is not None:
acc = self.cluster_acc(y, y_pred)[0]
self.accuracy.append(acc)
print('Iteration '+str(iteration)+', Accuracy '+str(np.round(acc, 5)))
else:
print(str(np.round(delta_label*100, 5))+'% change in label assignment')
if delta_label < tol:
print('Reached tolerance threshold. Stopping training.')
train = False
np.save("cluster_loss", np.asarray(cluster_loss))
continue
It should be !=
instead of ==
when it comes to delta_label, isn't it?
i noticed that too, when I modify the ending condition, the program stops at the first iteration (iteration 0) is it weird?
I got the same iteration problem on that. Anyone has any idea about that? @houdaM97 @tailongnguyen @fferroni @nadavbar
Yeah actually it was en error. You have to replace != by ==.