Lead-Time Prediction

Read predicted lead times, what drives each prediction, and how well the model performs, by model run.

Lead-time prediction is a machine learning model that predicts the lead time of each SKU-location from your supply history. GAINS Connect lets you read its predictions, the features behind each one, and the metrics that show how well the model performs. This page explains model runs, what each endpoint returns, and how to read the results.

These endpoints are available only when lead-time prediction is enabled for your environment. Otherwise they answer 403 Forbidden with a reason saying the service is not available on your environment.

Model runs

The model is retrained periodically, and each training produces a model run. Every request names the run it reads with ModelRunDate, the timestamp of that run, for example 2026-10-05 18:30:38. Results always come from one run, so predictions and metrics read with the same ModelRunDate belong together.

  • There is no "latest" run by default. Every request must name one.
  • There is no endpoint that lists model runs. Ask your GAINS representative for the run date of the model your planning uses.
  • A run that does not exist is not an error. The request answers 200: GET /ltp/predictions returns an empty Data, and the model metrics and feature value endpoints return one entry with empty lists. If you receive nothing, check the timestamp first.

Lead-time prediction endpoints

EndpointReturns
GET /ltp/predictionsThe predicted lead time of each SKU-location, or of one
GET /ltp/predictions/featuresWhat contributed to the prediction of one SKU-location
GET /ltp/models/trainingHow accurate the model is on the data it was trained on
GET /ltp/models/holdoutHow accurate the model is on data held back from training, at each probability threshold
GET /ltp/features/predictionsHow much the model relies on each feature to predict the lead time
GET /ltp/features/probabilityHow much the model relies on each feature to estimate its confidence
GET /ltp/features/evaluationsThe same feature values, measured on the held-back data

None of these subjects has a webhook, and none carries extended data. The API Reference lists the parameters each endpoint requires.

Reading predictions

Read every prediction of a run, or the prediction of one SKU-location:

GET /api/v1/ltp/predictions?ModelRunDate=2026-10-05%2018:30:38&ItemCode=ASM-7701&LocationCode=CHI01
{
  "DataType": "prediction",
  "Data": [
    {
      "ModelRunDate": "2026-10-05 18:30:38",
      "DataExtractDate": "2026-10-04",
      "ItemCode": "ASM-7701",
      "Locations": [
        {
          "LocationCode": "CHI01",
          "SupplierCode": "ACME",
          "Prediction": {
            "PredictedLeadTimeML": 18.0,
            "CurrentSKULLeadTime": 14.0,
            "PredictedProbability": 0.82,
            "PredictedSupplyVariability": 3.5,
            "MlFlag": true
          }
        }
      ]
    }
  ],
  "Paging": {
    "NextCursor": null,
    "CurrentDataCount": 1
  }
}

Each prediction sits beside the lead time GAINS currently holds for the SKU-location, so you can compare them. When MlFlag is false, GAINS keeps planning with the current lead time rather than the predicted one.

Predictions are grouped by item. Size and CurrentDataCount count SKU-locations, not items. An item's locations can continue on the next page, and items are not in a fixed order within a page: merge records with the same ItemCode across pages.

Explaining a prediction

GET /ltp/predictions/features returns, for one SKU-location, the features that moved its prediction most. Each entry of Features gives the feature's name, its value for that SKU-location, and its Contribution: how many days it added to or took from the predicted lead time. Use it to explain a prediction to a planner, for example a vendor whose recent deliveries have been late.

Model metrics and feature values

The model metrics and feature value endpoints describe the model as a whole, not a SKU-location. Each returns a single entry in Data per page:

  • Model metrics break accuracy down by lead time band, in weeks, and compare the model's error with the error of the historical lead time. The holdout endpoint adds, at each probability threshold, how many transactions would use the predicted lead time and how accurate it would be.
  • Feature values list each feature the model uses, with how important it is and the direction and size of its effect on the prediction.

When the results do not fit on one page, the next page carries the next part of the same entry: append its WeeklyMetrics, ThresholdMetric or Features to what you have already read.

Errors

These endpoints return the statuses described in Errors & Retries. Two are specific to lead-time prediction:

StatusCause
403 ForbiddenLead-time prediction is not enabled for your environment, or your client is not granted lead-time prediction access
500 Internal Server ErrorThe prediction service could not be reached. Retry later

Related


Did this page help you?