Data Science – What Is Recall@k ?

Table Of Contents:

  1. What Is Recall@k ?
  2. Example Of Recall@k .
  3. Where It Is Being Used ?
  4. Pro & Cons Of Recall@k
  5. Python Example Of Recall@k.

(1) What Is Recall@k?

(2) Example Of Recall@k?

(3) Interpretation Of Recall@k?

(4) Where Recall@k Is Being Used ?

(5) Pro & Con Of Recall@k .

(6) When To Use Recall@k ?

(7) Python Implementation Of Recall@k ?

pip install rank-eval
from rankeval.metrics import Recall

# predicted rankings per query (query_id: [doc_ids])
y_pred = {
    "q1": ["d2", "d1", "d3"],
    "q2": ["d5", "d7", "d9"]
}

# relevant ground truths (query_id: set of relevant doc_ids)
y_true = {
    "q1": {"d1", "d3"},
    "q2": {"d7"}
}

recall = Recall(k=2)
print(f"Recall@2: {recall.eval(y_pred, y_true):.2f}")

Leave a Reply

Your email address will not be published. Required fields are marked *