ForHeat (Forecasting Heat Demand) contains utilities and example models for short term heat demand forecasting using TensorFlow/Keras. The project demonstrates how to prepare time series data, train LSTM encoder–decoder networks and evaluate the resulting models.
The repository is not packaged for direct installation but all code can be executed from the cloned sources.
.
├── datasets/ Sample demand and weather data
├── load_and_norm.py Helper functions for loading and normalising datasets
├── lstm_tensorflow_model.py Training script for the LSTM model
├── predict_heat.py Evaluate a trained model and produce metrics
├── sequenced_data.py Utilities for windowing time series into sequences
├── utils/ Additional helper modules
├── requirements.txt Runtime dependencies
└── requirements-dev.txt Development tools
-
Clone the repository
git clone https://github.com/AminDar/HeatForecast.git cd HeatForecast -
Install dependencies (preferably inside a virtual environment)
pip install -r requirements.txt
-
Prepare data
The repository ships with example data under
datasets/. Theload_and_normalizefunction inload_and_norm.pywill split the data set, optionally remove future‑unknown features and apply Min–Max scaling.from load_and_norm import load_and_normalize dataset = "datasets/df_sin_cosing.csv" train_df, test_df, val_df, df_train_norm, df_test_norm, df_val_norm, scaler = \ load_and_normalize(dataset, columns_to_normalize=["Demand", "Temp"])
-
Create windowed datasets
SequencedDatainsequenced_data.pygenerates TensorFlow datasets suitable for an encoder–decoder model. A convenience functionload_default_data()builds these datasets using the provided CSV files.from sequenced_data import load_default_data data = load_default_data() windowed_train = data["windowed_train"] windowed_val = data["windowed_val"] windowed_test = data["windowed_test"]
lstm_tensorflow_model.py trains an LSTM encoder–decoder network. The script takes optional arguments for the number of epochs and the learning rate:
python lstm_tensorflow_model.py --nepoch 200 --learning_rate 0.001The model along with the fitted scaler and training history are stored in a timestamped subdirectory of weights/.
Use predict_heat.py to load a saved model and compute forecast metrics. By default the script picks the latest model in weights/:
python predict_heat.py --model-path weights/<timestamp>/whole_model.kerasMetrics for each 24 hour period and the overall results are written to CSV files inside Metrics/ and a line plot summarising the metrics is saved alongside them.
When training completes an example forecast plot is produced similar to the one below.
datasets/df_sin_cosing.csv contains hourly demand together with several engineered time and weather features. Two raw source files dhn_demand.csv and weather_denmark.csv are also provided. utils/preprocessing_eda.py demonstrates how these can be merged and enriched with cyclic time features, holidays and scaling utilities for exploratory analysis.
Contributions are welcome via pull requests. Please open an issue first to discuss substantial changes.
This project is licensed under the terms of the MIT License. See the LICENSE file for details.

