learning2rank
learning2rank copied to clipboard
ListNet predict nan
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):
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.