DEC-Keras icon indicating copy to clipboard operation
DEC-Keras copied to clipboard

Wrong ending condition

Open tailongnguyen opened this issue 6 years ago • 3 comments

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?

tailongnguyen avatar Apr 09 '18 08:04 tailongnguyen

i noticed that too, when I modify the ending condition, the program stops at the first iteration (iteration 0) is it weird?

houdaM97 avatar Jul 17 '20 11:07 houdaM97

I got the same iteration problem on that. Anyone has any idea about that? @houdaM97 @tailongnguyen @fferroni @nadavbar

kutaygonen avatar Apr 18 '21 11:04 kutaygonen

Yeah actually it was en error. You have to replace != by ==.

houdaM97 avatar Apr 18 '21 17:04 houdaM97