Metrics API

For a brief overview of GraphQL itself, please consult our introduction.

Average Metric Value

Metrics are associated with models; therefore, we utilize the model node to query for the average metric value.

AveragePerformanceQuery(
  $dataset: ModelDatasetInput, 
  $performanceMetric: PerformanceMetric!, 
  $predictionValueClass: String, 
  $timeZone: String!, 
  $id: ID!) {
  node(id: $id) {
    ... on Model {
      averagePerformanceMetric(
        performanceMetric: $performanceMetric
        positiveClass: $predictionValueClass
        timeZone: $timeZone
        dataset: $dataset
      )
    }
  }
}

Variables

{
  "dataset": {
    "startTime": "2024-06-25T06:00:00.000Z", #target start time
    "endTime": "2024-07-26T05:59:59.999Z", #target end time
    "externalModelVersionIds": [],
    "externalBatchIds": [],
    "environmentName": "production",
    "filters": []
  },
  "performanceMetric": "TargetMetric", 
  "predictionValueClass": "positiveClassValue",
  "timeZone": "time/zone", #The timezone of the request, used to determine the localized offset from UTC.
  "id": "model_id"
}

Metric Over Time

To analyze metric values over time or plot reconstruction, use the following query

query AveragePerformanceQuery(
  $performanceMetric: PerformanceMetric!
  $positiveClass:String!
  $startTime: DateTime!
  $endTime: DateTime!
  $timeZone: String!, 
  $id: ID!
  $environmentName: ModelEnvironmentName!
  $timeSeriesDataGranularity:DataGranularity!
) {
  node(id: $id) {
    __typename
    ... on Model {
      performanceMetricOverTime(
        performanceMetric: $performanceMetric
        timeZone: $timeZone,
        startTime: $startTime,
        endTime: $endTime,
        externalModelVersionIds: [],
        externalBatchIds: [],
        environmentName: $environmentName,
        timeSeriesDataGranularity: $timeSeriesDataGranularity
        filters: []
        positiveClass: $positiveClass
      ){
        dataPoints{
          x
          y
        }
      }
    }
    id
  }
}

Variables

{
  "performanceMetric": "metric",
  "positiveClass": "positive_class_value",
  "timeZone": "time/zome", #The timezone of the request, used to determine the localized offset from UTC.
  "id": "model_id",
  "startTime": "2024-06-25T06:00:00.000Z",
  "endTime": "2024-07-26T05:59:59.999Z",
  "environmentName": "production",
  "timeSeriesDataGranularity": "month", #desired granularity 
}

Last updated

Copyright © 2023 Arize AI, Inc