learning2rank icon indicating copy to clipboard operation
learning2rank copied to clipboard

ListNet predict nan

Open 823046544 opened this issue 5 years ago • 1 comments

here's my example code:

import numpy as np from learning2rank.rank import RankNet, ListNet Model = ListNet() X = np.array([[1, 2], [2, 3], [4, 5], [1, 3], [0, 0]]) y = np.array([1, 2, 3, 4, 5]) Model.fit(X, y) score = Model.predict(X) print(score)

I get the score as: [[nan] [nan] [nan] [nan] [nan]]

and I have changed the loss function as def ndcg(self, y_true, y_score, k=1):

823046544 avatar Jan 14 '20 03:01 823046544

It looks like you removed the import from the __init__.py file. Check the contents of __init__.py in every directory and then run the code. I hope this helps.

jeongwhanchoi avatar Oct 31 '20 12:10 jeongwhanchoi