# Precision\@K

**Objective:**&#x20;

Precision\@K measures how many of the top K retrieved or generated items are relevant to a query. It is a rank-based evaluation metric commonly used in information retrieval and recommendation systems. A higher Precision\@K score means the model has higher relevance among its top K results, indicating strong early retrieval performance, particularly when precision in high-rank positions is crucial.

**Required Columns in Dataset:**

`Prompt`, `Ranked Context`, `Labeled Text`

**Interpretation:**

* **High Precision\@K**: Shows that the top K results are highly relevant to the query, indicating the model's effectiveness in prioritizing the most appropriate outputs early in the ranking.
* **Low Precision\@K**: Suggests that the top K results contain irrelevant information, reflecting poor retrieval performance in terms of precision.

**Execution via UI:**

<figure><img src="/files/nboHpU5RtKLiDHbetQ46" alt=""><figcaption></figcaption></figure>

**Execution via SDK:**

Precision\_K doesn't require LLM for computation.

```python
metrics=[
    {"name": "Precision_K", "column_name": "your-text", "schema_mapping": schema_mapping}
]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.raga.ai/ragaai-catalyst/ragaai-metric-library/information-extraction/precision-k.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
