Skip to main content

Forecasting with Hyper-Trees

Project description

Release Notes
Open Source License: Apache 2.0 + Commons Clause
CI/CD github-actions
Code !python-versions Code coverage status badge
Downloads Pepy Total Downloads
Paper Arxiv link


Overview

Hyper-Trees are a novel framework for modeling time series data with gradient boosted trees (GBDTs). Instead of forecasting time series directly, Hyper-Trees use GBDTs to learn the parameters of a classical time series model such as ARIMA or Exponential Smoothing as functions of features. The target time series model then generates the final forecasts. This naturally injects the inductive bias of forecasting models into tree-based learning. While our framework is built upon the well-established LightGBM model, it can in principle be used with any modern GBDT framework.

Hyper-Tree architecture

Hyper-Trees offer several advantages:

  • Improved Extrapolation in Tree-Based Models. Forecasts are generated via a parametric target time series model, rather than the piece-wise constant output of tree-models.
  • Cross-Series Learning with Local Adaptivity. A global GBDT learns the feature-to-parameter mapping, so similar series share information while each still receives its own parameters.
  • Time-Varying Parameters. Coefficients vary cross-sectionally (series-specific features such as store type or region) and temporally (day, week, month, year, ...), capturing effects such as distinct AR(p) dynamics on weekdays versus weekends.
  • Model Transparency and Interpretability. Forecasts are produced by classical time series models whose parameters retain clear statistical meaning.
  • Full Functionality of GBDTs. Core GBDT capabilities (missing-value handling, feature importance, categorical support, monotonicity constraints) carry over unchanged.

News

[2024-05-01] Create repository and initial commits.


Available Models

Model Description Scope
Hyper-Tree-AR Autoregressive model with tree-learned, time-varying AR(p) parameters.
Hyper-TreeNet-AR Hybrid model combining tree embeddings with a neural network to learn AR(p) parameters.
Hyper-Tree-ETS Exponential smoothing model where ETS parameters are estimated by trees.
Hyper-Tree-STL STL decomposition with tree-learned parameters for trend and seasonality.

Global means a single model is trained across multiple time series; Local means a separate model is trained for each individual series. All models currently provide point forecasts only. Probabilistic forecasting is planned for future releases. Note on Hyper-Tree-STL: it is designed to decompose time series into trend and seasonal components and is not intended for forecasting. However, the STL-parameters can still be used to generate forecasts.

Getting Started

We refer to the examples/ notebooks for quick-start guides on using the Hyper-Tree models.


Installation

To run the Hyper-TreeNet-AR model efficiently, we recommend installing PyTorch with CUDA support. While GPU is recommended for faster runtime, it is not strictly required. All models also run on CPU. We use uv pip for installs. If you don't have uv, consider installing it or simply replace uv pip install with pip install.

Basic Installation (CPU)

Install the latest release from PyPI:

uv pip install hypertrees-forecasting

Or install the development version directly from GitHub:

uv pip install git+https://github.com/StatMixedML/Hyper-Trees.git

Or clone the repository and install in editable mode for development:

git clone https://github.com/StatMixedML/Hyper-Trees.git
cd Hyper-Trees
uv pip install -e .

This installs Hyper-Trees with the latest compatible versions of all dependencies, including a CPU-compatible version of PyTorch. All models will work, just without GPU acceleration.

Optional: Extra Dependencies

The example notebooks under examples/ use matplotlib (plotting), shap (feature-importance visualization), and optuna (hyper-parameter optimization). To install these alongside the package, use the extras option:

uv pip install "hypertrees-forecasting[extras]"     # from PyPI
uv pip install -e ".[extras]"                       # editable / development

These packages are not required to use the Hyper-Tree models themselves, only to run the example notebooks.

GPU Support

For CUDA-enabled PyTorch, install Hyper-Trees first, then install PyTorch from its CUDA index:

uv pip install torch --index-url https://download.pytorch.org/whl/cu121 --upgrade

Replace cu121 with the variant matching your driver. See pytorch.org/get-started/locally for the current list.

Reproducing Paper Results

The full reproducibility package, including the pinned environment, datasets, configurations, and experiment notebooks needed to reproduce all paper results, lives in the experiments/ folder. See the Experiments README for installation instructions and step-by-step guidance on running the experiments.


Early-stage software

hypertrees-forecasting is in an early stage of development and is provided “as is”, without any warranty or guarantee. We welcome bug reports, feature requests, and pull requests, and encourage feedback by opening a new discussion. We strongly recommend thorough testing and validation before using the package in production or other critical applications.


Acknowledgments

This work draws on and integrates methods and implementations from the following key repositories:

  • LightGBM – Gradient boosting framework for efficient tree-based learning.
  • PyTorch – Deep learning framework for tensor computation and neural network modeling.
  • Nixtla – Open Source Time Series Ecosystem.
  • sktime – A unified framework for machine learning with time series.
  • GluonTS – Probabilistic time series modeling and forecasting with deep learning.

License

This project is licensed under the Apache License 2.0 with Commons Clause License Condition v1.0. In short, the code is free for research, academic, testing, production, and internal commercial use; selling access to the Software's functionality as a primary offering (e.g., as an API service, managed service, or hosted offering) requires a separate commercial license. See the LICENSE file for details.


Citation

If you use Hyper-Trees in your research, please cite our paper:

Arxiv link

@article{maerz2024hypertrees,
  title   = {Forecasting with Hyper-Trees},
  author  = {März, Alexander and Rasul, Kashif},
  journal = {arXiv preprint arXiv:2405.07836},
  year    = {2024}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hypertrees_forecasting-0.1.0.tar.gz (87.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hypertrees_forecasting-0.1.0-py3-none-any.whl (56.7 kB view details)

Uploaded Python 3

File details

Details for the file hypertrees_forecasting-0.1.0.tar.gz.

File metadata

  • Download URL: hypertrees_forecasting-0.1.0.tar.gz
  • Upload date:
  • Size: 87.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hypertrees_forecasting-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ef178fb59b9e3c849ce4b922a54465af5506463587846f53605db739f73803bf
MD5 ea17519f8f488bfefb81368c85b964f1
BLAKE2b-256 271cb5fda947f7b5eef56a42c152af4f8893627d75dc7fb9e76e22bcced46a14

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypertrees_forecasting-0.1.0.tar.gz:

Publisher: release.yml on StatMixedML/Hyper-Trees

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hypertrees_forecasting-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hypertrees_forecasting-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 defde9f2c2fa4296a68a7be5c02ceaba2aedf699988627dabdbc5bc79aeaa1c8
MD5 c5a2cb631f086e7922ad70c378ab7492
BLAKE2b-256 15527d7da8e8e76ddb09c8bfd3cddd292a8e3d082770cda7e3549bc16ca48324

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypertrees_forecasting-0.1.0-py3-none-any.whl:

Publisher: release.yml on StatMixedML/Hyper-Trees

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page