Regression

How to log your model schema for regression models

Regression Model Overview

Regression models have a continuous, numeric output. (Examples: click-through rates, sales forecasting, customer lifetime value, ETA models, etc.)

Performance Metrics

MAPE, MAE, RMSE, MSE, R-Squared, Mean Error

Allowed Metric Families: Regression

Click here for all valid model types and metric combinations.

Regression Code Example

Example Row

price (float)
pos_approved (bool)
zip_code
age
prediction_score
actual_score
prediction_ts

88.5

False

12345

25

100

90

1671572541

# feature & tag columns can be optionally defined with typing:
tag_columns = TypedColumns(
    inferred=["name"],
    to_int=["zip_code", "age"]
)

# 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_score_column_name="prediction_score",
    actual_score_column_name="actual_score",
    feature_column_names=["price", "pos_approved"],
    tag_column_names=tag_columns,
)
# Log the dataframe with the schema mapping
response = client.log(
    model_id='sample-model-1', 
    model_version='v1', 
    model_type=ModelTypes.REGRESSION,
    metrics_validation=[Metrics.REGRESSION],
    environment=Environments.PRODUCTION,
    dataframe=test_dataframe,
    schema=schema
)

Quick Definitions

Prediction Label: The numeric value of the prediction (float | int)

Actual Label: The numeric value of the actual (float | int)

Last updated

Copyright © 2023 Arize AI, Inc

#1912:

Change request updated