Multi-Class

MultiClassPredictionLabel

Arize class to define the prediction and threshold arguments associated with the multi-class model type.

class MultiClassPredictionLabel(
    prediction_scores: Dict[str, Union[float, int]] #required
    threshold_scores: Dict[str, Union[float, int]] = None # optional but required for multi-label use cases
)
Argument
Data Type
Definitions

prediction_scores

Dict[str, Union[Float, int]]

(Required) The prediction scores of the classes

threshold_scores

Dict[str, Union[Float, int]]

(Optional) The threshold scores of the classes. Required for Multi-Label use cases.

MultiClassActualLabel

Arize class to define the actual arguments associated with the multi-class model type.

class MultiClassActualLabel(
    actual_scores: Dict[str, Union[float, int]] 
)
Argument
Data Type
Definitions

actual_scores

Dict[str, Union[Float, int]]

(Required) The actual scores of the classes. Any class in actual_scores with a score of 1 will be sent to Arize.

Code Example

pred_label = MultiClassPredictionLabel(
	prediction_scores=record["prediction_scores"],
        threshold_scores=record["threshold_scores"],     #additional parameter for multi-label use cases
)
actual_label = MultiClassActualLabel(
	actual_scores={record["actual_class"]: 1},
)
response = arize_client.log(
    model_id="multiclass-classification-multi-label-single-record-ingestion-tutorial",
    model_version="1.0",
    model_type=ModelTypes.MULTI_CLASS,
    environment=Environments.PRODUCTION,
    prediction_id=record["prediction_id"],
    prediction_label=pred_label,
    actual_label=actual_label,
    features=record["features"]
)

Last updated

Copyright © 2023 Arize AI, Inc

#1912:

Change request updated