jma127 / pyltr

Python learning to rank (LTR) toolkit
BSD 3-Clause "New" or "Revised" License
463 stars 107 forks source link

TypeError: only integer scalar arrays can be converted to a scalar index #15

Closed senjed closed 5 years ago

senjed commented 5 years ago

Hi, I am using the same code as provided in Readme.txt with a different data and I keep getting this error. Spend a lot of time fixing it but no luck. Do you have any idea what might have caused it?

File "somefile.py", line 691, in ltr print 'Our model:', metric.calc_mean(Eqids, Ey, Epred) File "/anaconda2/lib/python2.7/site-packages/pyltr-0.2.4-py2.7.egg/pyltr/metrics/_metrics.py", line 157, in calc_mean for qid, a, b in query_groups]) File "/anaconda2/lib/python2.7/site-packages/pyltr-0.2.4-py2.7.egg/pyltr/metrics/_metrics.py", line 108, in evaluate_preds return self.evaluate(qid, get_sorted_y(targets, preds)) File "/anaconda2/lib/python2.7/site-packages/pyltr-0.2.4-py2.7.egg/pyltr/util/sort.py", line 36, in get_sorted_y return y[get_sorted_y_positions(y, y_pred, check=check)] TypeError: only integer scalar arrays can be converted to a scalar index

VincentRoest commented 5 years ago

I'm having the same issue, did you figure out what the error was?