Skip to content
Log inGet startedHugging FaceGitHub

Endpoints

Forecast

POST/v1/series/forecast

Forecasts every series in the request horizon steps ahead, with nine quantiles at every step. This forecasts monthly airline passengers: the Python and CLI tabs send the whole history and ask for two years; the cURL tab writes the last twelve months into the request by hand and asks for two months:

import pandas as pd
from yhatlabs import Client
url = "https://raw.githubusercontent.com/jbrownlee/Datasets/master/"
df = pd.read_csv(url + "airline-passengers.csv") # columns: Month, Passengers
yh = Client()
fc = yh.forecast(df, h=24, time_col="Month", target_col="Passengers", level=[80])
print(fc.df.head(3).round(1))
Output
unique_id Month q10 median q90
series_0 1961-01-01 430.5 448.5 468.0
series_0 1961-02-01 408.9 430.9 452.0
series_0 1961-03-01 449.0 486.7 508.2

Parameters: Client.forecast

The cURL tab is the raw request; the other tabs build it from a table for you.

Field Type Required / default Description
model string "chakra-ts" The model, as GET /v1/models lists it.
series array of Series required 1 to 256 series; 8,000,000 points in total, counting covariates. (at most 256)
horizon integer required Steps to forecast, at freq. (min 1, max 2048)
freq string "h" A pandas frequency alias: 15min, h, D, 2D, W-SUN, MS, QS-OCT, YE-DEC.
season integer optional The seasonal period in steps, to fix it instead of inferring it from freq. (min 1)
quantile_levels array of number optional Any levels in (0, 1); default the nine deciles. (at most 32)
samples integer optional Sample paths per series over the horizon. (min 1, max 1000)
seed integer optional Seed for the sample paths.
store boolean true false keeps this call out of your Logs (we still keep a copy to look into errors; never used for training).
history boolean false Also return the model’s forecasts of the windows just before the forecast.
preset fast, pro "fast" pro: slower, slightly sharper (models that have presets).
tune string optional Forecast with a tune (POST /v1/series/tunes): the tuned model when it beat the model as it is on your latest window, else the model as it is. The reply’s tune says which.

Each series:

Field Type Required / default Description
id string required Unique within the request. (max length 256)
values array of numbers or null optional Oldest first, equally spaced at freq; null marks a missing value.
targets object optional Instead of values: several targets of equal length.
past_covariates object of arrays optional Each as long as the history.
known_covariates object of arrays optional Each as long as the history plus horizon.

Covariates may be numbers, short text categories or null. A request may carry 8,000,000 points in total, counting covariates.

Field Type Description
id string The request id (also the X-Request-Id header).
model string
horizon integer
quantile_levels array of number The levels of every quantiles row, in order.
forecasts array of Forecast One per series, in request order.
usage object Quota units used: one per target column of each series.

Each entry of forecasts:

Field Type Description
id string The series’ id from the request.
quantiles array of array of number One row per step, one value per quantile level ([horizon][levels]).
targets object Several targets: {column: quantiles}, instead of quantiles.
samples array of array of number With samples=N: N paths over the horizon ([samples][horizon]).
target_samples object Several targets: {column: samples}.
history array of Window With history: the model’s forecasts of the windows just before the forecast, oldest first.
target_history object Several targets: {column: history}.

Levels beyond the deciles (quantile_levels such as 0.025 or 0.99), samples and history are listed in the capabilities of GET /v1/limits.