Models API

Learn how to query models and delete data using our programmatic API

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

Querying for Models

Models belong to a Space. Because of this, you can either query for models off of a Space node or a Model node directly.

The model or space id is in the url when you visit the corresponding page. The format looks like this: spaces/:space_id/models/:model_id.

You can also query for a list of models given the space id. More details here.

query {
  node(id: "model_id") {
    ... on Model {
      name
      modelType
      uri
    }
  }
}

The ModelsConnection off of Space provides a convenient way for you to pull models that match the given criteria. If you have a large number of models, you will have to use pagination to pull the complete list. This data can then be structured to your liking and be exported to the platform of your choosing.

Model Schema

You can query your model's schema through the Arize GraphQL API. The ModelSchema type contains important information about your models such as features , tags, predictions and actuals which is useful when programmatically creating Monitors.

For more examples see the Monitors API documentation.

Querying a Model's schema can return the equivalent of thousands of REST requests, resulting in a high computation cost on our servers. Be mindful of your complexity score to ensure your call falls within our complexity cost limit. More details here.

query {
  node(id: "model_id") {
    ... on Model {
      name
      modelSchema {
        features(first: 10) {
          edges {
            node {
              dimension {
                name
              }
            }
          }
        }
      }
    }
  }
}

Dimension Configuration

You can query binning information relating to your model's features, actuals, predictions and tags .

query {
  node(id: "model_id") {
    ... on Model {
      name
      modelSchema {
        features(first: 10) {
          edges {
            node {
              dimensionConfig {
                id
                dimensionName
                dimensionCategory
                numBins
                binOption
                bins
              }
            }
          }
        }
      }
    }
  }
}

Deleting Data

You can delete data from a specified time period from your model.

mutation deleteData(
  $modelId: ID!
  $startDate: Date!
  $endDate: Date!
  $deleteType: ModelDeleteDataType!
) {
  deleteData(
    input: {
      modelId: $modelId
      startDate: $startDate
      endDate: $endDate
      deleteType: $deleteType
    }
  ) {
    model {
      name
    }
  }
}

variables

{
"modelId": "model_id",
"startDate": "2024-01-01",
"endDate": "2024-01-05",
"deleteType": "PRODUCTION"
}

Arguments

  • modelId: The unique identifier for the model whose data is to be deleted.

  • startDate: The start date of the period for which data should be deleted. This date is inclusive. Example: "2024-03-01"

  • endDate: The end date of the period for which data should be deleted. This date is exclusive. Example: "2024-03-18"

  • deleteType: The type of data to delete. Possible values:

    • PRODUCTION: Will delete predictions, joined actuals, and shap data.

    • PREPRODUCTION: Will delete training and validation data.

Guidelines

  • For models with delayed actuals created before February 7, 2024, confirm that predictions intended for deletion have their delayed actuals or tags already joined. Unjoined data may resurface after the joiner's next run.

Update functionalities for all models will be available in an upcoming release, resolving the current joining requirement for pre-February 2024 models.

  • Deleting PRODUCTION data removes all associated data within the specified date range; specific versions cannot be targeted.

  • Deleting PREPRODUCTION data removes all data within the date range, with no ability to differentiate between training and validation sets.

  • Deletion is permanent; exercise caution as this action is irreversible.

  • This operation will take ~10 minutes before the deletion is reflected in the UI.

Last updated

Copyright © 2023 Arize AI, Inc