liveBook · Manning

Nixtla

As explained in Time Series Forecasting Using Foundation Models

nixtla_client is a client library for interacting programmatically with Nixtla forecasting services and retrieving forecast-related outputs.

nixtla is a Python client library for accessing Nixtla’s remotely hosted TimeGPT forecasting service. It requires an API key, sends data to external servers, and returns forecasting-related outputs without local model hardware. section 3.3

Use the client to:

  • Initialize NixtlaClient after loading an API key from a .env file. section 3.3.1
  • Plot single- or multiple-series data while mapping custom timestamp, identifier, and target columns. section 3.3.1
  • Run cross-validation with optional fine-tuning and compare results with or without exogenous features. section 10.2.4
  • Extract feature contributions and visualize Shapley values for individual forecasts. section 3.5.3

Minimal initialization

from dotenv import load_dotenv from nixtla import NixtlaClient load_dotenv() nixtla_client = NixtlaClient()

Listing 10.8 Cross-validating with TimeGPT
init = time()
timegpt_cv_fcsts = nixtla_client.cross_validation(
    df=df,
    h=HORIZON,
    n_windows=N_WINDOWS,
    finetune_steps=50,  #1
    finetune_loss="mae"  #2
)
print(f"TimeGPT time: {time() - init} seconds")
timegpt_cv_fcsts.to_csv("timegpt_preds.csv", header=True, index=False)

Inspect a complete cross-validation call using a forecast horizon, rolling windows, fine-tuning steps, and MAE loss. section 10.2.4

How Time Series Forecasting Using Foundation Models covers it

How deep it goes
Explains setup, column conventions, plotting, cross-validation, and Shapley outputs without detailing the proprietary model internals.
Examples
Uses Walmart weekly store sales, blog-visit forecasting, custom column names, and feature-contribution plots.
What it assumes
Assumes Python data handling and an API key, while demonstrating environment-variable setup and required time-series columns.
What you can do after
Operate TimeGPT through Python, configure data columns, run validation, and inspect feature effects.
How it connects
Connects TimeGPT with exogenous features, cross-validation, Shapley values, dotenv, and remote API execution.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Time Series Forecasting Using Foundation Models. The section links point to the parts of the book it draws on.