Reference
Python reference
from yhatmodels import ChakraTS, list_models, accept_license, plot_forecastChakraTS.from_pretrained
Section titled “ChakraTS.from_pretrained”ChakraTS.from_pretrained(model="ChakraTS-OS-10M", device=None, revision=None, token=None)| Argument | Meaning |
|---|---|
model |
a released model’s name (see list_models()), a Hugging Face repo id, or a local folder with config.json and the weights |
device |
"cuda", "mps" or "cpu"; by default an NVIDIA GPU, then an Apple GPU, then the CPU |
revision |
a Hugging Face revision of the weights |
token |
a Hugging Face token, for a private repository |
model.info describes the loaded model: name, license, parameters, longest history, patch sizes, quantile levels and
presets.
forecast
Section titled “forecast”model.forecast(data, h, *, quantiles=None, level=None, preset=None, cross_series=False, past=None, known=None, future=None, id_col=None, time_col=None, target_col=None, freq=None)| Argument | Meaning |
|---|---|
data |
arrays or a long DataFrame (Your data) |
h |
how many steps ahead |
quantiles |
levels in (0, 1), default 0.1, 0.5, 0.9; or "all" (Ranges) |
level |
central intervals in percent, e.g. [80, 95], instead of quantiles |
preset |
"pro" (default) or "fast" (Speed and devices) |
cross_series |
True or a group size: read related single-target series together |
past, known |
covariates (Covariates) |
future |
a DataFrame of the known columns’ values over the next h steps |
id_col, time_col, target_col |
DataFrame column names; a list of targets forecasts them jointly |
freq |
a pandas frequency alias; inferred when left out |
Returns arrays for array input and a DataFrame for DataFrame input. Arguments that only the hosted ChakraTS has
(static, calendar, samples, tune and others) raise a TypeError that points to the API.
evaluate
Section titled “evaluate”model.evaluate(data, h, *, windows=3, step=None, baselines=("seasonal_naive",), metrics=("mase", "sql", "wql", "mae", "rmse", "coverage@0.8"), compare=None, season=None, preset=None, cross_series=False, past=None, known=None, id_col=None, time_col=None, target_col=None, freq=None)Returns an EvaluationResult with .summary, .scores, .forecasts, .calibration, .plot() and
.plot_calibration(). See Backtesting.
model.tune(data, h, *, steps=300, preset=None, cross_series=False, past=None, known=None, id_col=None, time_col=None, target_col=None, freq=None, season=None, seed=0, min_gain=0.02, pick_steps=True, verbose=False)Returns a new ChakraTS with .report; the original model is unchanged. tuned.save(folder) writes a folder that
from_pretrained loads. See Fine-tuning.
Other functions
Section titled “Other functions”| Function | What it does |
|---|---|
list_models(task=None) |
the released models, their tasks and licenses |
accept_license(model) |
accepts a model’s license before its first download |
plot_forecast(history, fc) |
plots a forecast with its intervals (pip install "yhatmodels[plot]"); also takes a forecast DataFrame with history=df |
Errors
Section titled “Errors”| Error | When |
|---|---|
LicenseNotAcceptedError |
the model’s license has not been accepted yet (Install and license) |
ModelLoadError |
a model folder or repository is missing a file, or names an architecture the library does not have |
ValueError |
bad input, such as h=0, levels outside (0, 1), duplicate timestamps or a missing column; the message says what to fix |
Both library errors derive from YHatModelsError.
Environment variables
Section titled “Environment variables”| Variable | Use |
|---|---|
YHAT_MODELS_TOKEN |
the model download token, for servers and CI |
YHAT_API_KEY |
an API key works as a token too |
YHATMODELS_NO_BROWSER=1 |
never open a browser for the license step |
YHATMODELS_CACHE |
where the token and license records are kept (default ~/.cache/yhatmodels) |

