Arize AI
Search…
⌃K

Model Schema Reference

Familiarize yourself with model schema for different model types.

Overview

Arize logs model inferences, and these inferences have a schema. Depending on the model type, there are slight differences in the model schema.
While model types dictate type-specific schema parameters, there are also schema parameters that are type-agnostic.
These parameters act as model metadata and can be a part of any schema
Model Schema Parameters
Model Type-Specific
Model Type
Prediction Values
Actual Values
Model Schema Parameters
Model Type-Agnostic
Timestamp
Tags

Model Type-Agnostic Schema Parameters

Model schema data types are contingent upon your data ingestion method. Learn more about the required fields for your file type here.
Arize Field
Example
model_version
'v1'
environment
Environments.PRODUCTION
timestamp
1650125707
shap_values
shaps = {
'state': 0.23,
'city': 0.31,
'merchant_name': 0.10,
'pos_approved': 0.02,
'item_count': 0.06,
'merchant_type': 0.11,
'charge_amount': 0.29,
}
tags
tag/season

Example

In this example, we have a dataframe where each row is a model inference and the columns represent various parts of the model schema - features, predictions, and actuals, etc.
Dataframe with Model Inferences

Code Example

# Declare the schema of the dataframe you're sending (feature columns, predictions, timestamp, actuals)
schema = Schema(
prediction_id_column_name="prediction_id",
timestamp_column_name="prediction_ts",
prediction_label_column_name="PREDICTION",
prediction_score_column_name="PREDICTION_SCORE",
actual_label_column_name="ACTUAL",
actual_score_column_name="ACTUAL_SCORE",
feature_column_names=["MERCHANT_TYPE", "ENTRY_MODE", "STATE", "MEAN_AMOUNT", "STD_AMOUNT", "TX_AMOUNT"],
)
# Log the dataframe with the schema mapping
response = arize_client.log(
model_id="sample-model-1",
model_version= "v1",
model_type=ModelTypes.SCORE_CATEGORICAL,
environment=Environments.PRODUCTION,
dataframe=test_dataframe,
schema=schema,
)
Questions? Email us at [email protected] or Slack us in the #arize-support channel