Skip to main content

Package, containing multiple state-of-the-art forecasting models.

Project description

Overview

This Python package provides state-of-the-art models for short-term load forecasting (STLF), designed for both academic research and real-world energy applications.

The models and evaluation framework are described in the following publication:

Moosbrugger et al. (2025). Load Forecasting for Households and Energy Communities: Are Deep Learning Models Worth the Effort?
arXiv:2501.05000

For more details and the full project source code, visit the GitHub repository.

Quick Start

Install the package:

pip install loadforecasting_models

You can easily integrate and train our forecasting machine learning models in your Python workflow:

from loadforecasting_models import Knn, Lstm, Transformer, xLstm, Persistence, Normalizer
import torch

# ------------------------------------------------------------------------------
# Prepare training data using dummy (replace with your own) data
# ------------------------------------------------------------------------------
# Generate Random Data
x = torch.randn(365, 24, 10)   # Shape: (batches, seq_len, features)
y = torch.randn(365, 24, 1)    # Shape: (batches, seq_len, 1)

# Do train/test split
x_train = x[:330 ,: ,:]
y_train = y[:330 ,: ,:]
x_test = x[330: ,: ,:]
y_test = y[330: ,: ,:]

# Normalize data
normalizer = Normalizer()
x_train = normalizer.normalize_x(x_train, training=True)
y_train = normalizer.normalize_y(y_train, training=True)
x_test = normalizer.normalize_x(x_test, training=False)
y_test = normalizer.normalize_y(y_test, training=False)

# ------------------------------------------------------------------------------
# Train the model
# ------------------------------------------------------------------------------
myModel = Transformer(model_size='5k', normalizer=normalizer)
myModel.train_model(x_train, y_train, epochs=100, verbose=1)

# ------------------------------------------------------------------------------
# Make predictions
# ------------------------------------------------------------------------------
y_pred = myModel.predict(x_test)
y_pred = normalizer.de_normalize_y(y_pred)

print('\nOutput shape:', y_pred.shape)    # Should output 'torch.Size([35, 24, 1])'

Using a non-machine learning model is very similar, e.g. for a KNN model:

from loadforecasting_models import Knn, Lstm, Transformer, xLstm, Persistence, Normalizer
import torch

# Same setup as above
# ...
myModel = Knn(k=40, weights='distance', normalizer=normalizer)
myModel.train_model(x_train, y_train)
# ...

Using automatic machine-learning hyperparameter tuning. This automatically optimizes hyperparameters like nr-of-epochs, batch-sizes, model-size, and learning-rate:

from loadforecasting_models import Knn, Lstm, Transformer, xLstm, Persistence, Normalizer
import torch

# Same setup as above
# ...
myModel = Transformer()
myModel.train_model_auto(x_train, y_train)
# ...

Currently Available Model Types:

  • 'Transformer'

  • 'Lstm'

  • 'xLstm'

  • 'Knn'

  • 'Persistence'

Citation

If you use this package in your work, please cite the following paper:

@article{moosbrugger2025load,
  title={Load Forecasting for Households and Energy Communities: Are Deep Learning Models Worth the Effort?},
  author={Moosbrugger, Lukas and Seiler, Valentin and Wohlgenannt, Philipp and Hegenbart, Sebastian and Ristov, Sashko and Eder, Elias and Kepplinger, Peter},
  journal={arXiv preprint},
  year={2025},
  doi={10.48550/arXiv.2501.05000}
}

License

This project is open-source and available under the terms of the MIT License.

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

loadforecasting_models-0.3.3.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

loadforecasting_models-0.3.3-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file loadforecasting_models-0.3.3.tar.gz.

File metadata

  • Download URL: loadforecasting_models-0.3.3.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for loadforecasting_models-0.3.3.tar.gz
Algorithm Hash digest
SHA256 e821415f1187658604b969202280edefcebc7aa5602854e3204f9d356f0d1cc7
MD5 71d77e30df49691418f53a00cacde922
BLAKE2b-256 fd30667a25752b76ab7e691f4fcf89608dc6745758edbf351725875629147826

See more details on using hashes here.

File details

Details for the file loadforecasting_models-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for loadforecasting_models-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 07f9200731e4be0c65dd67cb3aaf6d5354e1753b6780e560d27a5620913f32d2
MD5 1cc892ce1dccd81fe53b8d7f5c7a1ad0
BLAKE2b-256 dd49ddf076ca8c9867a4c89c248f23d56ab9778cd571d1639e9a84da2f715c2c

See more details on using hashes here.

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