Search
⌃K
Links

log

Arize method to log model data record-by-record.
log(
model_id: str,
model_type: ModelTypes,
environment: Environments,
model_version: Optional[str] = None,
prediction_id: Optional[Union[str, int, float]] = None,
prediction_timestamp: Optional[int] = None,
prediction_label: Union[str, bool, int, float, Tuple[str, float]] = None,
actual_label: Union[str, bool, int, float, Tuple[str, float]] = None,
features: Optional[Dict[str, Union[str, bool, float, int]]] = None,
embedding_features: Optional[Dict[str, Embedding]] = None,
shap_values: Dict[str, float] = None,
tags: Optional[Dict[str, Union[str, bool, float, int]]] = None,
batch_id: Optional[str] = None
)
Paramater
Data Type
Description
model_id
str
(Required) A unique name to identify your model in the Arize platform
model_type
(Required*) Declared what model type this prediction/actual is for *(as of v.5.X.X)
environment
(Required*) The environment that this prediction/actual is for (Production, Training, Validation) *(as of v.5.X.X)
model_version
str
(Optional) Used to group together a subset of predictions and actuals for a given model_id. Defaults to no_version
prediction_id
str
(Optional) A unique string to identify a prediction event.
Important: This value matches a prediction to an actual label or feature importance (SHAP) in the Arize platform. If prediction_id is not provided, Arize will, when possible, create a random prediction id on the server side.
prediction_timestamp
int
(Optional) int representing Unix epoch time in seconds, set overwrite the timestamp for prediction.
If None, default to log prediction using the current timestamp.
Important: Future and Historical predictions are supported up to 1 year from current wall clock time.
prediction_label
One of str, bool, int, float, Tuple[str,float]
(Optional) The predicted value for a given model input. *Ingest ranking predictions as a ranking object
actual_label
One of str, bool, int, float, Tuple[str,float]
(Optional) The actual or ground truth value for a given model input. Important: This actual will be matched to the prediction with the same prediction_id as the one in this call even if they were logged in separate log calls. *Ingest ranking actuals as a ranking object
features
[dict<str, [str, bool, float, int]>)]
(Optional) Dictionary containing human readable and debuggable model features.
Keys must be of typestr. Values must be one of str, bool, float, int.
embedding_features
(Optional) Dictionary containing human readable and debuggable model embedding features. Keys must be str. Values must be Embedding object
shap_values
[dict<str, float>]
(Optional) Dictionary containing human readable and debuggable model features keys, along with SHAP feature importance values. Keys must bestr, Values must befloat.
tags
[dict<str, [str, bool, float, long]>]
(Optional) Dictionary containing human readable and debuggable meta data that can be added on a prediction ID. This can be used to filter analysis by non-feature data. Keys must bestr. Values must be one of str, bool, float, long.
batch_id
str
(Optional) Only applicable to Validation datasets. Used to distinguish different batch of data under the same model_id and model_version.

Code Example

future = arize_client.log(
prediction_id=record["prediction_id"],
features=record["features"],
prediction_label=record["predicted_label"],
actual_label=record["actual_label"],
model_id="binary-classification-metrics-only-single-record-ingestion-tutorial",
model_type=ModelTypes.BINARY_CLASSIFICATION,
model_version="1.0.0",
environment=Environments.PRODUCTION
)
result = future.result()
Last modified 17d ago