ZichaoHuang/TransE

Evaluate rank seems wrong

Closed this issue · 2 comments

In the evaluate method of model.py, the rank calculation seems wrong to me.

If I understand correctly, tf.nn.top_k(tf.reduce_sum(tf.abs(distance_head_prediction), axis=1), k=self.kg.n_entity) will return the entities that are furthest from the predicted head, instead of the closest. So shouldn't this line be

tf.nn.top_k(-tf.reduce_sum(tf.abs(distance_head_prediction), axis=1), k=self.kg.n_entity)

I do the trick at line 235 and line 244 of model.py.

Ah, yes, I see. Thanks for the clarification!