allRank icon indicating copy to clipboard operation
allRank copied to clipboard

How to get prediction score

Open niccola-tartaglia opened this issue 2 years ago • 3 comments

Similar question as this in this post #59.

That post uses __rank_slates to obtain predicted ranks for y but that doesn't seem to be correct to me. When you look at the function it just returns the original y vector after it has been re orderd (or reranked) but not the predicted ranks.

Is there a function that returns the predicted ranks? or get a predicted score and then generate the rank ourselves?

niccola-tartaglia avatar May 16 '23 14:05 niccola-tartaglia

Another post #44 has mentioned the use of the score function, but I don't understand how to use this from the main script after a model has been trained.

niccola-tartaglia avatar May 16 '23 15:05 niccola-tartaglia

Here is a colab showing the usage of allrank for getting scores for a dataset.

https://colab.research.google.com/drive/1YqtomZ1KI09mOeNDhHTpae-7HRi5Lyh_?usp=sharing

It is basically run of

  1. generate_dummy_data
  2. train a model
  3. score a dataset using a model

parts 1 & 2 are the same as what happens in https://github.com/allegro/allRank/blob/master/scripts/run_example.sh

part 3 is adaptation of

https://github.com/allegro/allRank/blob/master/allrank/rank_and_click.py and https://github.com/allegro/allRank/blob/master/allrank/inference/inference_utils.py to just do scoring and return.

It currently requires a normal dataset (with Y values, since they are used for masking), even though for inference we one shouldn't be forced to provide Y_true

@niccola-tartaglia LMK if that helps!

kretes avatar May 17 '23 12:05 kretes

Thank you so much for sharing this, I will go through this example!!

niccola-tartaglia avatar May 18 '23 02:05 niccola-tartaglia