Overview
Last updated
apr_model = aporia.create_model_version(
model_id="<MODEL_ID>",
model_version="v1",
model_type="binary"
raw_inputs={
"raw_text": "text",
},
features={
"amount": "numeric",
"owner": "string",
"is_new": "boolean",
"embeddings": {"type": "tensor", "dimensions": [768]},
},
predictions={
"will_buy_insurance": "boolean",
"proba": "numeric",
},
)
apr_model.connect_serving(
data_source=data_source,
# Names of the prediction ID and prediction timestamp columns
id_column="prediction_id",
timestamp_column="prediction_timestamp",
)apr_model = aporia.create_model_version(
...
predictions={
"will_buy_insurance": "boolean"
}
)
apr_model.connect_serving(
data_source=data_source,
id_column="prediction_id",
timestamp_column="prediction_timestamp",
labels={
# Prediction name -> Column name representing
"will_buy_insurance": "did_buy_insurance"
}
)# Training set
apr_model.connect_training(
data_source=training_set_data_source,
id_column="id",
timestamp_column="timestamp",
)
# Test set
apr_model.connect_testing(
data_source=test_set_data_source,
id_column="id",
timestamp_column="timestamp",
)apr_model.connect_serving(
data_source=aporia.GlueDataSource(
database="datalake",
query="""
SELECT
my_id,
full_name,
age,
my_gender_col,
decision,
was_decision_correct,
occurred_at,
FROM predictions
""",
),
id_column="my_id",
timestamp_column="occurred_at",
raw_inputs={
"fullname": "full_name",
}
features={
"age": "age",
"gender": "my_gender_col",
},
predictions={
"will_buy_insurance": "decision",
},
labels={
"will_buy_insurance": "was_decision_correct"
}
)