Skip to main content

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_idstr(Required) Name for ranking groups or lists in ranking models
rankint(Required) Name for rank of each element on the its group or list. The content of this column must be integer between 1-100.
scorefloat(Optional) Numeric prediction score
labelstr(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_labelsList[str](Optional) Categorical ground truth score
relevance_scorefloat(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,
)