Querying metrics
To query metrics from Aporia, initialize a new client and call the query_metrics
API:
Parameters
The query_metrics
API has the following parameters:
model_id
str
Model ID to query metrics for.
metrics
List[MetricParameters]
List of metrics to query.
The API can request values for multiple metrics concurrently.
MetricParameters
Here are different fields for the MetricParameters
object:
name
str
dataset
MetricDataset
Specifies what data to query (training / serving), what segment, and what timeframe. Required.
column
str
Name of the column to calculate the metric for.
Required except for the count
metric. For performance metrics, this should be the name of the prediction, not the actual.
k
int
K value for ranking metrics such as nDCG.
Required only for ndcg_at_k
, map_at_k
, mrr_at_k
, accuracy_at_k
, precision_at_k
, and recall_at_k
.
threshold
float
Threshold to use when calculating binary performance metrics.
Required only if the prediction is numeric
and the actual is boolean
, and the metric is a binary performance metric such as accuracy
, recall
, precision
, f1_score
, etc.
custom_metric_id
str
Custom metric ID.
Required only if you want to query a custom metric.
baseline
MetricDataset
Specifies what data to use as baseline.
Required only for statistical distances such as js_distance
, ks_distance
, psi
, and hellinger_distance
.
MetricDataset
The MetricDataset
object contains the following fields:
dataset_type
DatasetType
Can be either DatasetType.SERVING
or DatasetType.TRAINING
. Required.
time_range
TimeRange
Time range (contains start
and end
fields). Do not pass this for training.
model_version
str
Model version to filter by. Optional.
segment
MetricSegment
Used to query metrics in a specific data segment. Contains id
and value
fields.
Last updated