Ranking

RankingPredictionLabel

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

class RankingPredictionLabel(
    group_id: str # required
    rank: int # required
    score: Optional[float]
    label: Optional[str]
)
ArgumentData TypeDefinitions

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

class RankingActualLabel(
    relevance_labels: Optional[List[str]]
    relevance_score: Optional[float]
)
ArgumentData TypeDescription

relevance_labels

List[str]

(Optional) Categorical ground truth score

relevance_score

float

(Optional) Numeric Ground truth score

Code Example

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,
)

Last updated

Copyright © 2023 Arize AI, Inc