> ## Documentation Index
> Fetch the complete documentation index at: https://arize-ax.mintlify.site/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Ranking

<CardGroup>
  <Card title="View source on Github" href="https://github.com/Arize-ai/client_python/blob/main/src/arize/utils/types.py#L289" icon="github" horizontal />
</CardGroup>

### RankingPredictionLabel

Arize class to define the prediction arguments associated with the ranking model type

```python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
class RankingPredictionLabel(
    group_id: str # required
    rank: int # required
    score: Optional[float]
    label: Optional[str]
)
```

| Argument | Data Type | Definitions |
| - | - | - |
| `group_id` | str | (Required) Name for ranking groups or lists in ranking models |
| `rank` | int | (Required) Name for rank of each element on the its group or list. The content of this column must be integer between 1-100. |
| `score` | float | (Optional) Numeric prediction score |
| `label` | str | (Optional) Categorical prediction score |

### RankingActualLabel

Arize class to define the ground truth arguments associated with the ranking model type

```python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
class RankingActualLabel(
    relevance_labels: Optional[List[str]]
    relevance_score: Optional[float]
)
```

| Argument | Data Type | Description |
| - | - | - |
| `relevance_labels` | List\[str] | (Optional) Categorical ground truth score |
| `relevance_score` | float | (Optional) Numeric Ground truth score |

### Code Example

```python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
from arize.utils.types import Environments, ModelTypes, Schema, RankingPredictionLabel, RankingActualLabel

pred_label = RankingPredictionLabel(
    group_id="A",
    rank=1,
    score=1.0,
    label="click",
)

act_label = RankingActualLabel(
    relevance_labels=["click", "save"],
    relevance_score=0.5,
)

response = arize.log(
    model_id="demo-ranking-single-log",
    model_version="v1",
    environment=Environments.PRODUCTION,
    model_type=ModelTypes.RANKING,
    prediction_id="123",
    prediction_label=pred_label,
    actual_label=act_label,
    features=features,
)
```
