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 models in your Python workflow. Here's an example using the Transformer-based sequence-to-sequence model:

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

# ------------------------------------------------------------------------------
# Define dataset parameters
# ------------------------------------------------------------------------------
features = 10          # Number of input features
seq_len = 24           # Sequence length (e.g., 24 hours)
batches_train = 365    # Number of training samples (e.g., one year of daily sequences)
batches_test = 90      # Number of test samples

# ------------------------------------------------------------------------------
# Prepare training data
# ------------------------------------------------------------------------------
normalizer = Normalizer()

# Generate dummy training data (replace with your own)
x_train = torch.randn(batches_train, seq_len, features)   # Shape: (batch_size, seq_len, features)
y_train = torch.randn(batches_train, seq_len, 1)          # Shape: (batch_size, seq_len, 1)

# Normalize data
x_train = normalizer.normalize_x(x_train, training=True)
y_train = normalizer.normalize_y(y_train, training=True)

# ------------------------------------------------------------------------------
# Initialize and train the model
# ------------------------------------------------------------------------------

# Available models: Transformer, LSTM, xLSTM, KNN, Persistence
myModel = Transformer(model_size='5k', num_of_features=features,
    normalizer=normalizer)
myModel.train_model(x_train, y_train, epochs=100, verbose=0)

# ------------------------------------------------------------------------------
# Make predictions
# ------------------------------------------------------------------------------
x_test = torch.randn(batches_test, seq_len, features)
x_test = normalizer.normalize_x(x_test, training=False)
y_pred = myModel.predict(x_test)
y_pred = normalizer.de_normalize_y(y_pred, training=False)

print('\nOutput shape:', y_pred.shape)

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.2.0.tar.gz (12.3 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.2.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for loadforecasting_models-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5439e700524c8dc9fa65d4c87221354051e33a01ffda1bdf52f08152e0f4fcd6
MD5 b63483ca5bf0ce1671de4c92b6837f5e
BLAKE2b-256 531c0aad309424bc9a7460ca7b08a205be7e6a6961451d833dd75effc9811332

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for loadforecasting_models-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76af7592c082a1eae332d26a6efcb031813eb5e7cb8e6ee115b6f22a872d55e2
MD5 87941c9c4231ea730ac25b95af7306d0
BLAKE2b-256 8d80681d432e00fe83fb72e5e1fbd06f6bf8121c033766aec6c4accacbffddc7

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