Open speeding-motor opened 5 years ago
def topkprob(self, vec, k=5): vec_sort = np.sort(vec)[-1::-1] topk = vec_sort[:k] ary = np.arange(k) return np.prod([np.exp(topk[i]) / np.sum(np.exp(topk[i:])) for i in ary])
def listwise_cost(self, list_ans, list_pred): return - np.sum(self.topkprob(list_ans) * np.log(self.topkprob(list_pred)))
the loss function in there, it's make me counfused, it's not use Probability of Different Combinatorial Sequences to compute the loss right?
sorry for your confusion. as written in the readme, ListNet implementation is not the exact paper. https://github.com/shiba24/learning2rank#listnet If you want to use ListNet, maybe you can look at https://github.com/fullflu/learning-to-rank as well.
sorry for your confusion. as written in the readme, ListNet implementation is not the exact paper. https://github.com/shiba24/learning2rank#listnet If you want to use ListNet, maybe you can look at https://github.com/fullflu/learning-to-rank as well.
thank you very very very...much to answer me,thank you....
now I understand, you use the author algorithm right, but I stil have one Doubt, why you use the sort function before to compute the loss,
for example:
if there have sequence [A, B, C], and the y_true_score is [10, 5, 0], and the y_pred is [5, 10, 0],
if you use the sort function here, the y_true sequence is still [A,B,C], but y_pred will be [B,A,C], so finally, when we use the:
self.topkprob(list_ans) * np.log(self.topkprob(list_pred))
we are calculate the y_true[A,B,C] sequence y_pred[B, A, C] cross entry here.....so is that you want finally?
how to compute the loss function....we only use one sequence if enough or need to use any different sequence to get the loss