0 / 0
Use the IBM Granite time series foundation models and forecast API to forecast future values (beta)
Last updated: Dec 05, 2024
Use the IBM Granite time series foundation models and forecast API to forecast future values (beta)

Use the time series forecast API and IBM Granite time series models that are available from watsonx.ai to forecast future values based on historic data.

Important: The time series forecast method of the watsonx.ai API is available as a beta feature.

API reference

For details, see the API reference documentation.

Python SDK

You can write code that uses the time series models to forecast data by using the watsonx.ai Python library. For more information, see the following references:

Time series forecasting

Use the time series API to pass historical data observations to a time series foundation model that can forecast future values with zero-shot inferencing. For example, you can use this method to forecast future values based on historic observations from the following types of data:

  • Stock share prices and trading volumes
  • Electrocardiogram (EKG) data or polysomnogram (PSG) records
  • Temperature or seismographic data
  • Network performance measurements

Supported foundation models

IBM Granite time series foundation models with the following model IDs are available to use for forecasting in watsonx.ai:

  • ibm/granite-ttm-512-96-r2: Requires at least 512 data points per dataset.
  • ibm/granite-ttm-1024-96-r2: Requires at least 1,024 data points per dataset.
  • ibm/granite-ttm-1536-96-r2: Requires at least 1,536 data points per dataset.

The Granite time series models work best with data points in minute or hour intervals and generate a forecast dataset with 96 data points. For best results, use the model that takes the most data points based on the data available to you.

For more information about the models, see IBM foundation models.

To programmatically get a list of the time series models that are available for use, you can use the List the available foundation models method in the watsonx.ai as a service API. Specify the filters=function_time_series_forecast parameter to return only the available time series models.

For example:

curl -X GET \
  '{url}/ml/v1/foundation_model_specs?version=2024-11-14&filters=function_time_series_forecast'

In the example, replace the {url} variable with the right value for your instance, such as us-south.ml.cloud.ibm.com.

Data requirements

A time series is a collection of data points that are collected over time.

To use the Granite time series models to forecast future values, the data that you submit for analysis must meet the following requirements:

  • The recorded data must be numerical, such as temperatures or stock share prices.

  • Your data must include enough data points of historical context for the model to be able to make a prediction. Each time series foundation model specifies a required minimum number of data points per dataset. If you specify more than the required number, the model uses the most recent data points up to the model requirement and ignores the rest.

  • Each dataset must have an equal number of items in the arrays that are specified for the date, id_columns, and target_columns that are included in the request body. You cannot skip a data point or specify null as the data point. Check your data before you submit the request.

  • Although the service accepts most common date and time formats, when you specify dates with time stamps in ISO 8601 format (2024-11-12T15:06:35), you avoid confusion that can arise due to differences in date formatting conventions. For example, does 11/12/2024 mean November 12 or December 11? Specify dates in ISO 8601 format with the coordinated universal time (UTC) offset (2024-11-12T15:06:35+0000) to avoid apparent duplicate or missing timestamps in the generated forecasting results.

  • Sample the data at a uniform frequency. For example, data can be observed in increments of 1 minute, 1 hour, or 1 day. No error is generated if your timestamps are not uniform, but the quality of your results might be poor. The generated forecast data is also formatted with the frequency that you specify with the freq parameter.

    For example, if you specify a frequency of one day ("freq":"1D"), your time stamps probably look something like this:

    "date": [
          "2024-11-15T15:06:35",
          "2024-11-16T15:06:35",
    ...
    ]
    

    If the frequency is 5 minutes ("freq":"5min"), each date time stamp is likely 5 minutes apart.

    "date": [
          "2024-11-15T15:06:35",
          "2024-11-15T15:11:35",
    ...
    ]
    

    For supported values for date and time abbreviations in the frequency parameter, see Period aliases in the documentation of the pandas library.

  • If you include data points from more than one source for analysis, each data point must provide a unique identifier to indicate which dataset it belongs to.

    For example, if you are analyzing shopping trends, you might be interested in sales figures from multiple stores during the holiday season. The following table shows two datasets, A and B. Dataset A shows the sales per day for location A and dataset B shows the sales per day for location B.

    Table 1. Sample sales data
    Date Dataset Sales total (USD)
    7 December 2023 A $24,988
    7 December 2023 B $63,788
    8 December 2023 A $41,855
    8 December 2023 B $105,678
    ... ... ...

    Although the table shows observations from two days, your request must include between 512 to 1,536 data points, depending on the model you use. When the data from the table is submitted to the API, it is formatted as follows:

    ...
    "data": {
    "date": [
      "2024-12-07T00:00:00",
      "2024-12-07T00:00:00",
      "2024-12-08T00:00:00",
      "2024-12-08T00:00:00",
      ...
    ],
    "ids": [
      "A",
      "B",
      "A",
      "B",
      ...
    ],
    "sales-usd": [
      24988,
      63788,
      41855,
      105678,
      ...
    ]
    }
    
  • You can forecast by using multivariate data points, meaning data points that measure different factors during the same time interval.

    For example, you might be interested in both sales and returns from one store during the holiday season. The following table shows a few entries from two datasets. One dataset shows the sales per day and the other dataset shows the returns per day.

    Table 2. Sample sales and returns data
    Date Sales (USD) Returns (USD)
    7 December 2023 $63,788 $14,788
    8 December 2023 $105,678 $25,678
    ... ... ...

    Although the table shows observations from two days, your request must include between 512 to 1,536 data points, depending on the model you use. When the data from the table is submitted to the API, it is formatted as follows:

    ...
    "data": {
    "date": [
      "2024-12-07T00:00:00",
      "2024-12-07T00:00:00",
      "2024-12-08T00:00:00",
      "2024-12-08T00:00:00",
      ...
    ],
    "ids": [
      "sales",
      "returns",
      "sales",
      "returns",
      ...
    ],
    "sales": [
      63788,
      105678,
      ...
    ],
    "returns": [
      14788,
      25678
      ...
    ]
    }
    

Example

This example uses the granite-ttm-512-96-r2 model to forecast energy consumption in kilowatt hours per hour based on hourly data points for the time span from 1 August to 22 August 2024.

Data from only one dataset is submitted, which means the optional id_columns object can be omitted from the schema. If more than one dataset is used, the id_columns object must be included.

The request body is divided into two sections:

  • Schema: Specifies which datasets will be included and which fields to analyze.
  • Data: The data to be analyzed.

The schema looks like this:

"schema": {
    "timestamp_column": "date",
    "freq":"1h",
    "target_columns": [
      "consumption-kwh"
    ]
  },

The data includes the information that is shown in the following table.

Table 3. Sample energy consumption data
Date and time (date) Hourly energy consumption in kWh (consumption-kwh)
2024-08-01T00:00:00 1.343
2024-08-01T01:00:00 1.274
2024-08-01T02:00:00 1.126

The model requires at least 512 data points per dataset to ensure that there is enough data for the model to predict future values. Although the table shows 3 data points, the request body contains 528 data points.

In the following example, replace the '{url}variable with the right value for your instance, such asus-south.ml.cloud.ibm.com`. Add your own bearer token and project ID.

Example REST request

curl -X POST \
  'https://{region}.ml.cloud.ibm.com/ml/v1/time_series/forecast?version=2024-11-15' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer eyJraWQiOi...' \
  --data '{
      "model_id":"
    }'

The data payload contains the following JSON snippet:

{
  "model_id":"ibm/granite-ttm-512-96-r2",
  "project_id":"4ab1437e-4c9d-47cf-9926-9ab52db1ee01",
  "schema": {
    "timestamp_column": "date",
            "freq":"1h",
            "target_columns": [
                "consumption-kwh"
            ]
        },
  "data": {
        "date": [
            "2024-08-01T00:00:00",
"2024-08-01T01:00:00",
"2024-08-01T02:00:00",
"2024-08-01T03:00:00",
"2024-08-01T04:00:00",
"2024-08-01T05:00:00",
"2024-08-01T06:00:00",
"2024-08-01T07:00:00",
"2024-08-01T08:00:00",
"2024-08-01T09:00:00",
"2024-08-01T10:00:00",
"2024-08-01T11:00:00",
"2024-08-01T12:00:00",
"2024-08-01T13:00:00",
"2024-08-01T14:00:00",
"2024-08-01T15:00:00",
"2024-08-01T16:00:00",
"2024-08-01T17:00:00",
"2024-08-01T18:00:00",
"2024-08-01T19:00:00",
"2024-08-01T20:00:00",
"2024-08-01T21:00:00",
"2024-08-01T22:00:00",
"2024-08-01T23:00:00",
"2024-08-02T00:00:00",
"2024-08-02T01:00:00",
"2024-08-02T02:00:00",
"2024-08-02T03:00:00",
"2024-08-02T04:00:00",
"2024-08-02T05:00:00",
"2024-08-02T06:00:00",
"2024-08-02T07:00:00",
"2024-08-02T08:00:00",
"2024-08-02T09:00:00",
"2024-08-02T10:00:00",
"2024-08-02T11:00:00",
"2024-08-02T12:00:00",
"2024-08-02T13:00:00",
"2024-08-02T14:00:00",
"2024-08-02T15:00:00",
"2024-08-02T16:00:00",
"2024-08-02T17:00:00",
"2024-08-02T18:00:00",
"2024-08-02T19:00:00",
"2024-08-02T20:00:00",
"2024-08-02T21:00:00",
"2024-08-02T22:00:00",
"2024-08-02T23:00:00",
"2024-08-03T00:00:00",
"2024-08-03T01:00:00",
"2024-08-03T02:00:00",
"2024-08-03T03:00:00",
"2024-08-03T04:00:00",
"2024-08-03T05:00:00",
"2024-08-03T06:00:00",
"2024-08-03T07:00:00",
"2024-08-03T08:00:00",
"2024-08-03T09:00:00",
"2024-08-03T10:00:00",
"2024-08-03T11:00:00",
"2024-08-03T12:00:00",
"2024-08-03T13:00:00",
"2024-08-03T14:00:00",
"2024-08-03T15:00:00",
"2024-08-03T16:00:00",
"2024-08-03T17:00:00",
"2024-08-03T18:00:00",
"2024-08-03T19:00:00",
"2024-08-03T20:00:00",
"2024-08-03T21:00:00",
"2024-08-03T22:00:00",
"2024-08-03T23:00:00",
"2024-08-04T00:00:00",
"2024-08-04T01:00:00",
"2024-08-04T02:00:00",
"2024-08-04T03:00:00",
"2024-08-04T04:00:00",
"2024-08-04T05:00:00",
"2024-08-04T06:00:00",
"2024-08-04T07:00:00",
"2024-08-04T08:00:00",
"2024-08-04T09:00:00",
"2024-08-04T10:00:00",
"2024-08-04T11:00:00",
"2024-08-04T12:00:00",
"2024-08-04T13:00:00",
"2024-08-04T14:00:00",
"2024-08-04T15:00:00",
"2024-08-04T16:00:00",
"2024-08-04T17:00:00",
"2024-08-04T18:00:00",
"2024-08-04T19:00:00",
"2024-08-04T20:00:00",
"2024-08-04T21:00:00",
"2024-08-04T22:00:00",
"2024-08-04T23:00:00",
"2024-08-05T00:00:00",
"2024-08-05T01:00:00",
"2024-08-05T02:00:00",
"2024-08-05T03:00:00",
"2024-08-05T04:00:00",
"2024-08-05T05:00:00",
"2024-08-05T06:00:00",
"2024-08-05T07:00:00",
"2024-08-05T08:00:00",
"2024-08-05T09:00:00",
"2024-08-05T10:00:00",
"2024-08-05T11:00:00",
"2024-08-05T12:00:00",
"2024-08-05T13:00:00",
"2024-08-05T14:00:00",
"2024-08-05T15:00:00",
"2024-08-05T16:00:00",
"2024-08-05T17:00:00",
"2024-08-05T18:00:00",
"2024-08-05T19:00:00",
"2024-08-05T20:00:00",
"2024-08-05T21:00:00",
"2024-08-05T22:00:00",
"2024-08-05T23:00:00",
"2024-08-06T00:00:00",
"2024-08-06T01:00:00",
"2024-08-06T02:00:00",
"2024-08-06T03:00:00",
"2024-08-06T04:00:00",
"2024-08-06T05:00:00",
"2024-08-06T06:00:00",
"2024-08-06T07:00:00",
"2024-08-06T08:00:00",
"2024-08-06T09:00:00",
"2024-08-06T10:00:00",
"2024-08-06T11:00:00",
"2024-08-06T12:00:00",
"2024-08-06T13:00:00",
"2024-08-06T14:00:00",
"2024-08-06T15:00:00",
"2024-08-06T16:00:00",
"2024-08-06T17:00:00",
"2024-08-06T18:00:00",
"2024-08-06T19:00:00",
"2024-08-06T20:00:00",
"2024-08-06T21:00:00",
"2024-08-06T22:00:00",
"2024-08-06T23:00:00",
"2024-08-07T00:00:00",
"2024-08-07T01:00:00",
"2024-08-07T02:00:00",
"2024-08-07T03:00:00",
"2024-08-07T04:00:00",
"2024-08-07T05:00:00",
"2024-08-07T06:00:00",
"2024-08-07T07:00:00",
"2024-08-07T08:00:00",
"2024-08-07T09:00:00",
"2024-08-07T10:00:00",
"2024-08-07T11:00:00",
"2024-08-07T12:00:00",
"2024-08-07T13:00:00",
"2024-08-07T14:00:00",
"2024-08-07T15:00:00",
"2024-08-07T16:00:00",
"2024-08-07T17:00:00",
"2024-08-07T18:00:00",
"2024-08-07T19:00:00",
"2024-08-07T20:00:00",
"2024-08-07T21:00:00",
"2024-08-07T22:00:00",
"2024-08-07T23:00:00",
"2024-08-08T00:00:00",
"2024-08-08T01:00:00",
"2024-08-08T02:00:00",
"2024-08-08T03:00:00",
"2024-08-08T04:00:00",
"2024-08-08T05:00:00",
"2024-08-08T06:00:00",
"2024-08-08T07:00:00",
"2024-08-08T08:00:00",
"2024-08-08T09:00:00",
"2024-08-08T10:00:00",
"2024-08-08T11:00:00",
"2024-08-08T12:00:00",
"2024-08-08T13:00:00",
"2024-08-08T14:00:00",
"2024-08-08T15:00:00",
"2024-08-08T16:00:00",
"2024-08-08T17:00:00",
"2024-08-08T18:00:00",
"2024-08-08T19:00:00",
"2024-08-08T20:00:00",
"2024-08-08T21:00:00",
"2024-08-08T22:00:00",
"2024-08-08T23:00:00",
"2024-08-09T00:00:00",
"2024-08-09T01:00:00",
"2024-08-09T02:00:00",
"2024-08-09T03:00:00",
"2024-08-09T04:00:00",
"2024-08-09T05:00:00",
"2024-08-09T06:00:00",
"2024-08-09T07:00:00",
"2024-08-09T08:00:00",
"2024-08-09T09:00:00",
"2024-08-09T10:00:00",
"2024-08-09T11:00:00",
"2024-08-09T12:00:00",
"2024-08-09T13:00:00",
"2024-08-09T14:00:00",
"2024-08-09T15:00:00",
"2024-08-09T16:00:00",
"2024-08-09T17:00:00",
"2024-08-09T18:00:00",
"2024-08-09T19:00:00",
"2024-08-09T20:00:00",
"2024-08-09T21:00:00",
"2024-08-09T22:00:00",
"2024-08-09T23:00:00",
"2024-08-10T00:00:00",
"2024-08-10T01:00:00",
"2024-08-10T02:00:00",
"2024-08-10T03:00:00",
"2024-08-10T04:00:00",
"2024-08-10T05:00:00",
"2024-08-10T06:00:00",
"2024-08-10T07:00:00",
"2024-08-10T08:00:00",
"2024-08-10T09:00:00",
"2024-08-10T10:00:00",
"2024-08-10T11:00:00",
"2024-08-10T12:00:00",
"2024-08-10T13:00:00",
"2024-08-10T14:00:00",
"2024-08-10T15:00:00",
"2024-08-10T16:00:00",
"2024-08-10T17:00:00",
"2024-08-10T18:00:00",
"2024-08-10T19:00:00",
"2024-08-10T20:00:00",
"2024-08-10T21:00:00",
"2024-08-10T22:00:00",
"2024-08-10T23:00:00",
"2024-08-11T00:00:00",
"2024-08-11T01:00:00",
"2024-08-11T02:00:00",
"2024-08-11T03:00:00",
"2024-08-11T04:00:00",
"2024-08-11T05:00:00",
"2024-08-11T06:00:00",
"2024-08-11T07:00:00",
"2024-08-11T08:00:00",
"2024-08-11T09:00:00",
"2024-08-11T10:00:00",
"2024-08-11T11:00:00",
"2024-08-11T12:00:00",
"2024-08-11T13:00:00",
"2024-08-11T14:00:00",
"2024-08-11T15:00:00",
"2024-08-11T16:00:00",
"2024-08-11T17:00:00",
"2024-08-11T18:00:00",
"2024-08-11T19:00:00",
"2024-08-11T20:00:00",
"2024-08-11T21:00:00",
"2024-08-11T22:00:00",
"2024-08-11T23:00:00",
"2024-08-12T00:00:00",
"2024-08-12T01:00:00",
"2024-08-12T02:00:00",
"2024-08-12T03:00:00",
"2024-08-12T04:00:00",
"2024-08-12T05:00:00",
"2024-08-12T06:00:00",
"2024-08-12T07:00:00",
"2024-08-12T08:00:00",
"2024-08-12T09:00:00",
"2024-08-12T10:00:00",
"2024-08-12T11:00:00",
"2024-08-12T12:00:00",
"2024-08-12T13:00:00",
"2024-08-12T14:00:00",
"2024-08-12T15:00:00",
"2024-08-12T16:00:00",
"2024-08-12T17:00:00",
"2024-08-12T18:00:00",
"2024-08-12T19:00:00",
"2024-08-12T20:00:00",
"2024-08-12T21:00:00",
"2024-08-12T22:00:00",
"2024-08-12T23:00:00",
"2024-08-13T00:00:00",
"2024-08-13T01:00:00",
"2024-08-13T02:00:00",
"2024-08-13T03:00:00",
"2024-08-13T04:00:00",
"2024-08-13T05:00:00",
"2024-08-13T06:00:00",
"2024-08-13T07:00:00",
"2024-08-13T08:00:00",
"2024-08-13T09:00:00",
"2024-08-13T10:00:00",
"2024-08-13T11:00:00",
"2024-08-13T12:00:00",
"2024-08-13T13:00:00",
"2024-08-13T14:00:00",
"2024-08-13T15:00:00",
"2024-08-13T16:00:00",
"2024-08-13T17:00:00",
"2024-08-13T18:00:00",
"2024-08-13T19:00:00",
"2024-08-13T20:00:00",
"2024-08-13T21:00:00",
"2024-08-13T22:00:00",
"2024-08-13T23:00:00",
"2024-08-14T00:00:00",
"2024-08-14T01:00:00",
"2024-08-14T02:00:00",
"2024-08-14T03:00:00",
"2024-08-14T04:00:00",
"2024-08-14T05:00:00",
"2024-08-14T06:00:00",
"2024-08-14T07:00:00",
"2024-08-14T08:00:00",
"2024-08-14T09:00:00",
"2024-08-14T10:00:00",
"2024-08-14T11:00:00",
"2024-08-14T12:00:00",
"2024-08-14T13:00:00",
"2024-08-14T14:00:00",
"2024-08-14T15:00:00",
"2024-08-14T16:00:00",
"2024-08-14T17:00:00",
"2024-08-14T18:00:00",
"2024-08-14T19:00:00",
"2024-08-14T20:00:00",
"2024-08-14T21:00:00",
"2024-08-14T22:00:00",
"2024-08-14T23:00:00",
"2024-08-15T00:00:00",
"2024-08-15T01:00:00",
"2024-08-15T02:00:00",
"2024-08-15T03:00:00",
"2024-08-15T04:00:00",
"2024-08-15T05:00:00",
"2024-08-15T06:00:00",
"2024-08-15T07:00:00",
"2024-08-15T08:00:00",
"2024-08-15T09:00:00",
"2024-08-15T10:00:00",
"2024-08-15T11:00:00",
"2024-08-15T12:00:00",
"2024-08-15T13:00:00",
"2024-08-15T14:00:00",
"2024-08-15T15:00:00",
"2024-08-15T16:00:00",
"2024-08-15T17:00:00",
"2024-08-15T18:00:00",
"2024-08-15T19:00:00",
"2024-08-15T20:00:00",
"2024-08-15T21:00:00",
"2024-08-15T22:00:00",
"2024-08-15T23:00:00",
"2024-08-16T00:00:00",
"2024-08-16T01:00:00",
"2024-08-16T02:00:00",
"2024-08-16T03:00:00",
"2024-08-16T04:00:00",
"2024-08-16T05:00:00",
"2024-08-16T06:00:00",
"2024-08-16T07:00:00",
"2024-08-16T08:00:00",
"2024-08-16T09:00:00",
"2024-08-16T10:00:00",
"2024-08-16T11:00:00",
"2024-08-16T12:00:00",
"2024-08-16T13:00:00",
"2024-08-16T14:00:00",
"2024-08-16T15:00:00",
"2024-08-16T16:00:00",
"2024-08-16T17:00:00",
"2024-08-16T18:00:00",
"2024-08-16T19:00:00",
"2024-08-16T20:00:00",
"2024-08-16T21:00:00",
"2024-08-16T22:00:00",
"2024-08-16T23:00:00",
"2024-08-17T00:00:00",
"2024-08-17T01:00:00",
"2024-08-17T02:00:00",
"2024-08-17T03:00:00",
"2024-08-17T04:00:00",
"2024-08-17T05:00:00",
"2024-08-17T06:00:00",
"2024-08-17T07:00:00",
"2024-08-17T08:00:00",
"2024-08-17T09:00:00",
"2024-08-17T10:00:00",
"2024-08-17T11:00:00",
"2024-08-17T12:00:00",
"2024-08-17T13:00:00",
"2024-08-17T14:00:00",
"2024-08-17T15:00:00",
"2024-08-17T16:00:00",
"2024-08-17T17:00:00",
"2024-08-17T18:00:00",
"2024-08-17T19:00:00",
"2024-08-17T20:00:00",
"2024-08-17T21:00:00",
"2024-08-17T22:00:00",
"2024-08-17T23:00:00",
"2024-08-18T00:00:00",
"2024-08-18T01:00:00",
"2024-08-18T02:00:00",
"2024-08-18T03:00:00",
"2024-08-18T04:00:00",
"2024-08-18T05:00:00",
"2024-08-18T06:00:00",
"2024-08-18T07:00:00",
"2024-08-18T08:00:00",
"2024-08-18T09:00:00",
"2024-08-18T10:00:00",
"2024-08-18T11:00:00",
"2024-08-18T12:00:00",
"2024-08-18T13:00:00",
"2024-08-18T14:00:00",
"2024-08-18T15:00:00",
"2024-08-18T16:00:00",
"2024-08-18T17:00:00",
"2024-08-18T18:00:00",
"2024-08-18T19:00:00",
"2024-08-18T20:00:00",
"2024-08-18T21:00:00",
"2024-08-18T22:00:00",
"2024-08-18T23:00:00",
"2024-08-19T00:00:00",
"2024-08-19T01:00:00",
"2024-08-19T02:00:00",
"2024-08-19T03:00:00",
"2024-08-19T04:00:00",
"2024-08-19T05:00:00",
"2024-08-19T06:00:00",
"2024-08-19T07:00:00",
"2024-08-19T08:00:00",
"2024-08-19T09:00:00",
"2024-08-19T10:00:00",
"2024-08-19T11:00:00",
"2024-08-19T12:00:00",
"2024-08-19T13:00:00",
"2024-08-19T14:00:00",
"2024-08-19T15:00:00",
"2024-08-19T16:00:00",
"2024-08-19T17:00:00",
"2024-08-19T18:00:00",
"2024-08-19T19:00:00",
"2024-08-19T20:00:00",
"2024-08-19T21:00:00",
"2024-08-19T22:00:00",
"2024-08-19T23:00:00",
"2024-08-20T00:00:00",
"2024-08-20T01:00:00",
"2024-08-20T02:00:00",
"2024-08-20T03:00:00",
"2024-08-20T04:00:00",
"2024-08-20T05:00:00",
"2024-08-20T06:00:00",
"2024-08-20T07:00:00",
"2024-08-20T08:00:00",
"2024-08-20T09:00:00",
"2024-08-20T10:00:00",
"2024-08-20T11:00:00",
"2024-08-20T12:00:00",
"2024-08-20T13:00:00",
"2024-08-20T14:00:00",
"2024-08-20T15:00:00",
"2024-08-20T16:00:00",
"2024-08-20T17:00:00",
"2024-08-20T18:00:00",
"2024-08-20T19:00:00",
"2024-08-20T20:00:00",
"2024-08-20T21:00:00",
"2024-08-20T22:00:00",
"2024-08-20T23:00:00",
"2024-08-21T00:00:00",
"2024-08-21T01:00:00",
"2024-08-21T02:00:00",
"2024-08-21T03:00:00",
"2024-08-21T04:00:00",
"2024-08-21T05:00:00",
"2024-08-21T06:00:00",
"2024-08-21T07:00:00",
"2024-08-21T08:00:00",
"2024-08-21T09:00:00",
"2024-08-21T10:00:00",
"2024-08-21T11:00:00",
"2024-08-21T12:00:00",
"2024-08-21T13:00:00",
"2024-08-21T14:00:00",
"2024-08-21T15:00:00",
"2024-08-21T16:00:00",
"2024-08-21T17:00:00",
"2024-08-21T18:00:00",
"2024-08-21T19:00:00",
"2024-08-21T20:00:00",
"2024-08-21T21:00:00",
"2024-08-21T22:00:00",
"2024-08-21T23:00:00",
"2024-08-22T00:00:00",
"2024-08-22T01:00:00",
"2024-08-22T02:00:00",
"2024-08-22T03:00:00",
"2024-08-22T04:00:00",
"2024-08-22T05:00:00",
"2024-08-22T06:00:00",
"2024-08-22T07:00:00",
"2024-08-22T08:00:00",
"2024-08-22T09:00:00",
"2024-08-22T10:00:00",
"2024-08-22T11:00:00",
"2024-08-22T12:00:00",
"2024-08-22T13:00:00",
"2024-08-22T14:00:00",
"2024-08-22T15:00:00",
"2024-08-22T16:00:00",
"2024-08-22T17:00:00",
"2024-08-22T18:00:00",
"2024-08-22T19:00:00",
"2024-08-22T20:00:00",
"2024-08-22T21:00:00",
"2024-08-22T22:00:00",
"2024-08-22T23:00:00"
        ],
        "consumption-kwh": [
            1.343,
1.274,
1.126,
1.179,
1.468,
1.266,
1.111,
0.976,
1.198,
1.301,
1.417,
1.475,
2.434,
3.153,
3.795,
3.666,
4.048,
3.556,
4.358,
4.707,
4.402,
3.069,
2.632,
2.189,
1.824,
1.627,
1.544,
1.447,
1.42,
1.357,
1.553,
1.425,
1.987,
1.262,
1.524,
1.646,
2.983,
2.941,
2.924,
3.529,
4.003,
3.318,
3.762,
4.184,
3.597,
2.484,
2.135,
1.863,
1.428,
1.312,
1.223,
1.294,
1.352,
1.278,
1.173,
0.957,
1.312,
0.905,
1.73,
1.828,
1.812,
2.627,
2.827,
2.137,
2.279,
1.929,
2.939,
4.306,
3.312,
2.616,
1.946,
1.694,
1.451,
1.442,
1.232,
1.338,
1.234,
1.197,
1.31,
1.481,
1.225,
2.331,
2.546,
2.3,
2.316,
2.612,
2.543,
2.214,
2.322,
2.089,
2.484,
3.193,
2.66,
2.104,
1.816,
1.458,
1.194,
1.046,
1.087,
1.156,
1.104,
1.01,
1.162,
1.035,
1.287,
1.542,
1.545,
1.461,
1.63,
1.735,
2.3,
2.656,
2.527,
2.547,
3.684,
4.637,
4.577,
4.629,
3.561,
2.676,
2.065,
2.13,
1.392,
1.488,
1.259,
1.185,
1.132,
1.477,
1.183,
1.336,
1.591,
1.366,
1.548,
1.523,
1.641,
1.732,
1.516,
1.609,
2.319,
2.323,
2.068,
1.911,
1.687,
1.219,
1.047,
1.128,
1.008,
1.019,
1.214,
1.146,
1.122,
1.159,
1.064,
1.086,
1.152,
1.067,
1.334,
1.43,
1.321,
1.48,
4.176,
2.608,
3.142,
4.715,
4.763,
2.33,
2.091,
1.735,
1.22,
1.101,
1.09,
1.003,
1.047,
1.014,
1.211,
1.606,
1.407,
1.747,
1.298,
1.318,
1.313,
1.306,
1.409,
1.38,
1.82,
2.457,
1.779,
2.195,
2.112,
1.869,
1.374,
1.258,
1.318,
1.427,
1.168,
1.071,
1.118,
1.074,
1.29,
1.214,
1.127,
1.294,
1.051,
1.021,
1.026,
1.041,
1.308,
1.335,
1.509,
1.43,
2.143,
2.923,
2.361,
2.237,
1.676,
1.435,
1.412,
1.481,
1.326,
1.392,
1.176,
1.222,
1.35,
1.448,
1.619,
2.35,
2.064,
2.027,
2.384,
2.618,
3.828,
4.274,
3.791,
2.647,
2.744,
3.041,
2.39,
1.857,
1.547,
1.425,
1.353,
1.278,
1.136,
1.138,
1.117,
1.061,
1.042,
1.07,
1.061,
1.031,
1.36,
1.558,
1.593,
2.09,
1.534,
3.368,
3.656,
3.373,
2.872,
3.064,
2.325,
2.012,
1.678,
1.268,
1.418,
1.154,
0.998,
1.092,
0.998,
0.947,
1.211,
1.608,
1.41,
1.587,
1.328,
1.602,
1.43,
1.266,
1.516,
1.427,
1.692,
1.98,
2.181,
2.611,
2.443,
1.926,
1.356,
1.061,
1.176,
1.005,
1.079,
0.985,
1.006,
0.959,
1.144,
1.073,
1.155,
0.998,
0.947,
1.056,
1.21,
1.302,
1.541,
1.357,
1.516,
1.576,
2.14,
3.058,
2.854,
2.051,
1.374,
1.223,
1.193,
1.103,
1.039,
1.042,
1.132,
1.129,
1.081,
1.311,
1.796,
1.769,
1.927,
1.512,
1.461,
1.361,
1.579,
2.45,
2.135,
2.111,
2.492,
3.149,
2.088,
1.639,
0.967,
1.4,
1.077,
0.8,
0.77,
0.765,
0.617,
0.688,
0.798,
0.709,
0.74,
0.805,
0.765,
0.923,
1.064,
1.116,
1.109,
1.107,
1.443,
2.504,
2.619,
2.919,
2.163,
1.728,
1.227,
1.124,
1.012,
1.054,
0.835,
0.883,
0.833,
0.962,
1.383,
1.135,
1.335,
1.035,
0.815,
0.683,
0.722,
0.798,
0.687,
0.698,
0.652,
0.793,
1.337,
1.712,
1.523,
1.389,
1.297,
0.605,
0.546,
0.546,
0.532,
0.532,
0.392,
0.444,
0.458,
0.529,
0.515,
0.676,
0.598,
0.544,
0.659,
1.43,
1.071,
0.792,
1.089,
1.205,
1.466,
2.226,
1.914,
1.756,
1.417,
1.315,
0.912,
0.884,
0.896,
0.791,
0.832,
0.796,
0.639,
0.848,
0.768,
0.893,
1.34,
1.433,
1.113,
1.026,
0.975,
0.515,
0.611,
0.508,
0.477,
0.908,
0.951,
0.755,
0.742,
0.572,
0.607,
0.683,
0.538,
0.6,
0.519,
0.557,
0.505,
0.517,
0.498,
0.496,
0.623,
0.477,
0.5,
0.566,
0.503,
0.492,
0.547,
0.531,
0.538,
0.527,
0.501,
0.532,
0.524,
0.56,
0.569,
0.825,
0.628,
0.516,
0.55,
0.518,
0.514,
0.576,
0.518,
0.551,
0.513,
0.513,
0.553,
0.537,
0.494,
0.523,
0.544,
0.503,
0.526,
0.526,
0.566,
0.529,
0.501,
0.548,
0.521,
0.484,
0.541,
0.502,
0.518,
0.538,
0.536,
0.455,
0.478,
0.57,
0.482,
0.468,
0.578,
0.486,
0.462,
0.504,
0.529,
0.509,
0.531,
0.536,
0.547,
0.544,
0.504,
0.498,
0.552,
0.521,
0.5,
0.515,
0.511,
0.52,
0.531,
0.488,
0.52,
0.552,
0.467,
0.486,
0.526,
0.489,
0.506,
0.534,
0.504,
0.48,
0.532,
0.503,
0.529,
0.58,
0.538,
0.485
        ]
    }
}

Example REST response

The following response is returned for the example request.

{
  "model_id": "ibm/granite-ttm-512-96-r2",
  "created_at": "2024-11-18T15:27:09.312Z",
  "results": [
    {
      "consumption-kwh": [
        0.4290124177932739,
        0.4370437264442444,
        0.41718316078186035,
        0.38737165927886963,
        0.3955392837524414,
        0.3834899663925171,
        0.4044222831726074,
        0.42463231086730957,
        0.44074130058288574,
        0.467449426651001,
        0.47343355417251587,
        0.46828728914260864,
        0.5056831240653992,
        0.5539732575416565,
        0.5736022591590881,
        0.5886504054069519,
        0.6298335194587708,
        0.6267642974853516,
        0.7561632990837097,
        0.9204491376876831,
        0.8508875966072083,
        0.6771538257598877,
        0.5467019081115723,
        0.5154763460159302,
        0.4935459494590759,
        0.5060797333717346,
        0.4897392988204956,
        0.4714925289154053,
        0.48243576288223267,
        0.47915470600128174,
        0.5149773359298706,
        0.5487560629844666,
        0.579269528388977,
        0.614227831363678,
        0.6240154504776001,
        0.617196261882782,
        0.6460352540016174,
        0.6916171908378601,
        0.7112790942192078,
        0.7198072075843811,
        0.7407637238502502,
        0.7113152146339417,
        0.8186711668968201,
        0.9680589437484741,
        0.8914456963539124,
        0.7246706485748291,
        0.6004055738449097,
        0.5758842825889587,
        0.5714154243469238,
        0.5996972918510437,
        0.5872698426246643,
        0.5638936758041382,
        0.562979519367218,
        0.5384628176689148,
        0.5483810305595398,
        0.5603788495063782,
        0.5766607522964478,
        0.6183720231056213,
        0.6395336389541626,
        0.6367053985595703,
        0.6625468134880066,
        0.7083823084831238,
        0.7353737354278564,
        0.7451785206794739,
        0.7608164548873901,
        0.7376626133918762,
        0.8453754186630249,
        0.9998173117637634,
        0.9389885663986206,
        0.7839845418930054,
        0.6516207456588745,
        0.6147481799125671,
        0.5945475697517395,
        0.6096962690353394,
        0.5845052599906921,
        0.5627552270889282,
        0.5692415237426758,
        0.5633142590522766,
        0.5928394198417664,
        0.6212420463562012,
        0.6465822458267212,
        0.6908603310585022,
        0.7119491696357727,
        0.7027047276496887,
        0.7215489745140076,
        0.7617378234863281,
        0.7871705293655396,
        0.7981688976287842,
        0.8154757618904114,
        0.8133115768432617,
        0.9371682405471802,
        1.0931875705718994,
        1.0331265926361084,
        0.8758280873298645,
        0.7418281435966492,
        0.7037395238876343
      ],
      "date": [
        "2024-08-23T00:00:00",
        "2024-08-23T01:00:00",
        "2024-08-23T02:00:00",
        "2024-08-23T03:00:00",
        "2024-08-23T04:00:00",
        "2024-08-23T05:00:00",
        "2024-08-23T06:00:00",
        "2024-08-23T07:00:00",
        "2024-08-23T08:00:00",
        "2024-08-23T09:00:00",
        "2024-08-23T10:00:00",
        "2024-08-23T11:00:00",
        "2024-08-23T12:00:00",
        "2024-08-23T13:00:00",
        "2024-08-23T14:00:00",
        "2024-08-23T15:00:00",
        "2024-08-23T16:00:00",
        "2024-08-23T17:00:00",
        "2024-08-23T18:00:00",
        "2024-08-23T19:00:00",
        "2024-08-23T20:00:00",
        "2024-08-23T21:00:00",
        "2024-08-23T22:00:00",
        "2024-08-23T23:00:00",
        "2024-08-24T00:00:00",
        "2024-08-24T01:00:00",
        "2024-08-24T02:00:00",
        "2024-08-24T03:00:00",
        "2024-08-24T04:00:00",
        "2024-08-24T05:00:00",
        "2024-08-24T06:00:00",
        "2024-08-24T07:00:00",
        "2024-08-24T08:00:00",
        "2024-08-24T09:00:00",
        "2024-08-24T10:00:00",
        "2024-08-24T11:00:00",
        "2024-08-24T12:00:00",
        "2024-08-24T13:00:00",
        "2024-08-24T14:00:00",
        "2024-08-24T15:00:00",
        "2024-08-24T16:00:00",
        "2024-08-24T17:00:00",
        "2024-08-24T18:00:00",
        "2024-08-24T19:00:00",
        "2024-08-24T20:00:00",
        "2024-08-24T21:00:00",
        "2024-08-24T22:00:00",
        "2024-08-24T23:00:00",
        "2024-08-25T00:00:00",
        "2024-08-25T01:00:00",
        "2024-08-25T02:00:00",
        "2024-08-25T03:00:00",
        "2024-08-25T04:00:00",
        "2024-08-25T05:00:00",
        "2024-08-25T06:00:00",
        "2024-08-25T07:00:00",
        "2024-08-25T08:00:00",
        "2024-08-25T09:00:00",
        "2024-08-25T10:00:00",
        "2024-08-25T11:00:00",
        "2024-08-25T12:00:00",
        "2024-08-25T13:00:00",
        "2024-08-25T14:00:00",
        "2024-08-25T15:00:00",
        "2024-08-25T16:00:00",
        "2024-08-25T17:00:00",
        "2024-08-25T18:00:00",
        "2024-08-25T19:00:00",
        "2024-08-25T20:00:00",
        "2024-08-25T21:00:00",
        "2024-08-25T22:00:00",
        "2024-08-25T23:00:00",
        "2024-08-26T00:00:00",
        "2024-08-26T01:00:00",
        "2024-08-26T02:00:00",
        "2024-08-26T03:00:00",
        "2024-08-26T04:00:00",
        "2024-08-26T05:00:00",
        "2024-08-26T06:00:00",
        "2024-08-26T07:00:00",
        "2024-08-26T08:00:00",
        "2024-08-26T09:00:00",
        "2024-08-26T10:00:00",
        "2024-08-26T11:00:00",
        "2024-08-26T12:00:00",
        "2024-08-26T13:00:00",
        "2024-08-26T14:00:00",
        "2024-08-26T15:00:00",
        "2024-08-26T16:00:00",
        "2024-08-26T17:00:00",
        "2024-08-26T18:00:00",
        "2024-08-26T19:00:00",
        "2024-08-26T20:00:00",
        "2024-08-26T21:00:00",
        "2024-08-26T22:00:00",
        "2024-08-26T23:00:00"
      ],
      "ids": [
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A",
        "A"
      ]
    }
  ]
}

The table in the following screenshot shows the forecasted energy consumption compared to the actual consumption. The table indicates that the model is able to correctly forecast the spikes in consumption, although the model's predicted consumption numbers are more conservative than the actual consumption numbers.

Shows the actual versus predicted hourly energy consumption.

Learn more

Parent topic: Coding generative AI solutions

Generative AI search and answer
These answers are generated by a large language model in watsonx.ai based on content from the product documentation. Learn more