NILMTK-Contrib with NILMBench2026

June 16, 2026 · View on GitHub

This is the nilmtk-contrib repository, extended with the NILMBench2026 benchmark contribution.

The repository has two connected parts:

  • NILMTK-Contrib package work: the reusable nilmtk_contrib Python package with NILMTK-compatible disaggregation models, preprocessing utilities, experiment workflows, optional backend extras, tests, and Docker packaging. The package is designed for use with NILMTK's rapid experimentation API and includes classical, TensorFlow, and PyTorch model backends.
  • NILMBench2026 contribution: the benchmark and reproducibility work built on top of nilmtk-contrib. NILMBench2026 evaluates sixteen NILM models across regression accuracy, event detection, computational efficiency, and generalization on public NILM datasets at both 1-minute and 15-minute resolutions.

NILMBench2026 uses the modernized nilmtk-contrib package in this repository as its implementation base. The benchmark contribution also documents the modernization and extension of the NILMTK ecosystem, including PyTorch model implementations, containerized workflows, and reproducible experiment setup.

This repository is based on the original nilmtk-contrib repository and extends it for the NILMBench2026 benchmark.

The repository is associated with two papers:

Kuloor, Singh, Dhru, and Batra, "NILMBench2026: A Benchmark for Energy Disaggregation", BuildSys 2026, DOI: https://doi.org/10.1145/3744256.3812587.

Batra, Kukunuri, Pandey, Malakar, Kumar, Krystalakos, Zhong, Meira, and Parson, "Towards Reproducible State-of-the-Art Energy Disaggregation", BuildSys 2019, DOI: https://doi.org/10.1145/3360322.3360844.

Citation

If you find our research useful, please consider citing:

@inproceedings{kuloor2026nilmbench,
  title     = {NILMBench2026: A Benchmark for Energy Disaggregation},
  author    = {Kuloor, Aayush and Singh, Anurag and Dhru, Harsh and Batra, Nipun},
  booktitle = {Proceedings of the 13th ACM International Conference on Systems for
               Energy-Efficient Buildings, Cities, and Transportation (BuildSys '26)},
  year      = {2026},
  doi       = {10.1145/3744256.3812587},
  publisher = {ACM},
  address   = {Banff, AB, Canada}
}
@inproceedings{10.1145/3360322.3360844,
  author = {Batra, Nipun and Kukunuri, Rithwik and Pandey, Ayush and Malakar, Raktim and Kumar, Rajat and Krystalakos, Odysseas and Zhong, Mingjun and Meira, Paulo and Parson, Oliver},
  title = {Towards Reproducible State-of-the-Art Energy Disaggregation},
  year = {2019},
  isbn = {9781450370059},
  publisher = {Association for Computing Machinery},
  address = {New York, NY, USA},
  url = {https://doi.org/10.1145/3360322.3360844},
  doi = {10.1145/3360322.3360844},
  booktitle = {Proceedings of the 6th ACM International Conference on Systems for Energy-Efficient Buildings, Cities, and Transportation},
  pages = {193--202},
  numpages = {10},
  keywords = {smart meters, energy disaggregation, non-intrusive load monitoring},
  location = {New York, NY, USA},
  series = {BuildSys '19}
}

Runtime Requirements

  • Python >=3.11,<3.12.
  • Install a backend extra before importing or training backend-specific models.
  • NILMTK-compatible datasets are required for real experiments, notebook runs, and benchmark reproduction.
  • Model training and benchmark comparisons should be run in controlled server environments with the relevant backend, dataset, and hardware available.

Python 3.12 and newer are not supported by the current package metadata because TensorFlow and NILMTK compatibility must be verified first.

Installation

Minimal install for package metadata and lightweight imports:

uv pip install git+https://github.com/nilmtk/nilmtk-contrib.git

TensorFlow backend:

uv pip install "nilmtk-contrib[tensorflow] @ git+https://github.com/nilmtk/nilmtk-contrib.git"

PyTorch backend:

uv pip install "nilmtk-contrib[torch] @ git+https://github.com/nilmtk/nilmtk-contrib.git"

Classical backend:

uv pip install "nilmtk-contrib[classical] @ git+https://github.com/nilmtk/nilmtk-contrib.git"

All model backends:

uv pip install "nilmtk-contrib[all] @ git+https://github.com/nilmtk/nilmtk-contrib.git"

Local development (from a clone of this repository):

uv sync --extra dev

Backend development examples:

uv sync --extra dev --extra torch
uv sync --extra dev --extra tensorflow
uv sync --extra dev --extra classical
uv sync --extra dev --extra all

Verify your install

After uv sync --extra dev, run a quick sanity check to confirm the package and core tests are in good shape:

uv run python -m compileall -q nilmtk_contrib tests
uv run python -m pytest -q tests/test_imports.py tests/test_params.py tests/test_preprocessing_windows.py tests/test_preprocessing_alignment.py tests/test_preprocessing_classification.py tests/test_validation.py tests/test_checkpoints.py tests/test_random_logging.py tests/test_model_runtime.py

Before launching full experiments, smoke-test the backend you plan to use. Sync the matching extra and run the full test suite—for example, with PyTorch:

uv sync --extra dev --extra torch
uv run python -m pytest -q

Docker

The repository ships a reproducible container image based on Python 3.11. The image installs nilmtk-contrib with uv, pins the Python runtime, and bundles the system libraries needed for NumPy, SciPy, scikit-learn, TensorFlow, and PyTorch.

Prerequisites

Pull the pre-built image

docker pull ghcr.io/nilmtk/nilmtk-contrib:latest
docker run --rm -it ghcr.io/nilmtk/nilmtk-contrib:latest bash

Backend-specific tags:

docker pull ghcr.io/nilmtk/nilmtk-contrib:torch
docker pull ghcr.io/nilmtk/nilmtk-contrib:tensorflow
docker pull ghcr.io/nilmtk/nilmtk-contrib:classical

GPU-enabled pre-built image:

docker run --rm -it --gpus all ghcr.io/nilmtk/nilmtk-contrib:latest bash

Build locally

Default all-backend image:

docker build -t nilmtk-contrib:all .

Backend-specific images (smaller, faster builds):

docker build -t nilmtk-contrib:torch --build-arg INSTALL_EXTRA=torch .
docker build -t nilmtk-contrib:tensorflow --build-arg INSTALL_EXTRA=tensorflow .
docker build -t nilmtk-contrib:classical --build-arg INSTALL_EXTRA=classical .

Image with dev/test dependencies:

docker build -t nilmtk-contrib:dev --build-arg INSTALL_DEV=true .

Run interactively

docker run --rm -it nilmtk-contrib:all bash

Mount a local dataset directory (read-only) at /data:

docker run --rm -it -v /path/to/datasets:/data:ro nilmtk-contrib:all bash

On Windows PowerShell, use a drive path such as -v C:/Users/you/datasets:/data:ro.

GPU-enabled shell (requires NVIDIA Container Toolkit):

docker run --rm -it --gpus all nilmtk-contrib:all bash

Inside the container, verify CUDA visibility for PyTorch:

python -c "import torch; print('cuda:', torch.cuda.is_available())"

Verify the image

Quick package and backend checks:

docker run --rm nilmtk-contrib:all python -c "import nilmtk_contrib; print(nilmtk_contrib.__version__)"
docker run --rm nilmtk-contrib:all python -c "import nilmtk_contrib.disaggregate, nilmtk_contrib.torch; print('imports ok')"
docker run --rm nilmtk-contrib:all python -c "import nilmtk, torch, tensorflow as tf; print('nilmtk ok'); print('torch', torch.__version__); print('tensorflow', tf.__version__)"

Compile and run the lightweight test subset (requires the dev image):

docker build -t nilmtk-contrib:dev --build-arg INSTALL_DEV=true .
docker run --rm nilmtk-contrib:dev python -m compileall -q nilmtk_contrib tests
docker run --rm nilmtk-contrib:dev python -m pytest -q \
  tests/test_imports.py \
  tests/test_params.py \
  tests/test_preprocessing_windows.py \
  tests/test_preprocessing_alignment.py \
  tests/test_preprocessing_classification.py \
  tests/test_validation.py \
  tests/test_checkpoints.py \
  tests/test_random_logging.py \
  tests/test_model_runtime.py

One-shot smoke test after building the default image:

docker run --rm nilmtk-contrib:all bash -lc "python -c \"import nilmtk_contrib; import torch; import tensorflow as tf; print('nilmtk-contrib', nilmtk_contrib.__version__); print('torch', torch.__version__); print('tensorflow', tf.__version__)\""

Docker build arguments

ArgumentDefaultAllowed valuesPurpose
INSTALL_EXTRAallall, torch, tensorflow, classicalOptional dependency extra to install
INSTALL_DEVfalsetrue, falseAlso install .[dev] for pytest and tooling

Files

FilePurpose
DockerfileMulti-backend image definition with build args
.dockerignoreKeeps build context small and excludes local artifacts

Dependency Extras

ExtraIntended useMain dependencies
MinimalImport package metadata and lightweight modulesNo required runtime dependencies
tensorflowTensorFlow/Keras disaggregatorsNILMTK, NumPy, pandas, scikit-learn, matplotlib, TensorFlow, tensorflow-io-gcs-filesystem
torchPyTorch disaggregatorsNILMTK, NumPy, pandas, scikit-learn, matplotlib, PyTorch, tqdm
classicalAFHMM, AFHMM_SAC, DSCNILMTK, NumPy, pandas, matplotlib, scikit-learn, SciPy, cvxpy, hmmlearn
allAll backendsUnion of TensorFlow, PyTorch, classical, and NILMTK dependencies
devTests, formatting, and build checkspytest, pytest-cov, black, ruff, build

Models

The table below lists the public model surface. "Verification" describes how the implementation should be cited and interpreted in research use.

AlgorithmBackendImport pathVerificationPaper/sourceNotes
AFHMMClassicalnilmtk_contrib.disaggregate.AFHMMNILM paper implementation, not independently benchmark-certified in this package stateKolter and Jaakkola, AFHMM for energy disaggregationRequires classical extra
AFHMM_SACClassicalnilmtk_contrib.disaggregate.AFHMM_SACNILM paper implementation, not independently benchmark-certified in this package stateZhong, Goddard, and Sutton, signal aggregate constraints in AFHMMsRequires classical extra
DSCClassicalnilmtk_contrib.disaggregate.DSCNILM paper implementation, not independently benchmark-certified in this package stateKolter, Batra, and Ng, discriminative sparse codingRequires classical extra
DAETensorFlownilmtk_contrib.disaggregate.DAENeural NILM implementation requiring experiment validation for new claimsKelly and Knottenbelt, Neural NILMTensorFlow/Keras backend
DAEPyTorchnilmtk_contrib.torch.DAEPyTorch implementation requiring parity validation for new claimsKelly and Knottenbelt, Neural NILMPyTorch backend
RNNTensorFlownilmtk_contrib.disaggregate.RNNNeural NILM implementation requiring experiment validation for new claimsKelly and Knottenbelt, Neural NILMTensorFlow/Keras backend
RNNPyTorchnilmtk_contrib.torch.RNNPyTorch implementation requiring parity validation for new claimsKelly and Knottenbelt, Neural NILMPyTorch backend
Seq2PointTensorFlownilmtk_contrib.disaggregate.Seq2PointNILM paper implementation requiring dataset-specific validationZhang et al., Sequence-to-Point LearningTensorFlow/Keras backend
Seq2PointTorchPyTorchnilmtk_contrib.torch.Seq2PointTorchPyTorch implementation requiring parity validation for new claimsZhang et al., Sequence-to-Point LearningPyTorch backend
Seq2SeqTensorFlownilmtk_contrib.disaggregate.Seq2SeqLegacy NILM baseline adapted from a generic sequence modelSutskever, Vinyals, and Le, sequence-to-sequence learningGeneric architecture citation
Seq2SeqPyTorchnilmtk_contrib.torch.Seq2SeqLegacy NILM baseline adapted from a generic sequence modelSutskever, Vinyals, and Le, sequence-to-sequence learningGeneric architecture citation
WindowGRUTensorFlownilmtk_contrib.disaggregate.WindowGRUNILM paper implementation requiring experiment validation for new claimsKrystalakos, Nalmpantis, and Vrakas, sliding-window GRUTensorFlow/Keras backend
WindowGRUPyTorchnilmtk_contrib.torch.WindowGRUPyTorch implementation requiring parity validation for new claimsKrystalakos, Nalmpantis, and Vrakas, sliding-window GRUPyTorch backend
RNN_attentionTensorFlownilmtk_contrib.disaggregate.RNN_attentionAttention-based NILM implementationSudoso and Piccialli, attention-based NILMTensorFlow/Keras backend
RNN_attentionPyTorchnilmtk_contrib.torch.RNN_attentionPyTorch attention-based NILM implementationAttention-based NILM literaturePyTorch backend
RNN_attention_classificationTensorFlownilmtk_contrib.disaggregate.RNN_attention_classificationAttention-based NILM implementation with classification branchSudoso and Piccialli, attention-based NILMExplicit on/off threshold parameters are supported
RNN_attention_classificationPyTorchnilmtk_contrib.torch.RNN_attention_classificationPyTorch attention-based NILM implementation with classification branchAttention-based NILM literatureExplicit on/off threshold parameters are supported
ResNetTensorFlownilmtk_contrib.disaggregate.ResNet1D residual NILM adaptation of a generic architectureHe et al., Deep Residual LearningGeneric computer-vision architecture adapted to NILM
ResNetPyTorchnilmtk_contrib.torch.ResNet1D residual NILM adaptation of a generic architectureHe et al., Deep Residual LearningGeneric computer-vision architecture adapted to NILM
ResNet_classificationTensorFlownilmtk_contrib.disaggregate.ResNet_classificationResidual NILM model with classification branchResidual and NILM classification literatureExplicit threshold and loss-weight parameters are supported
ResNet_classificationPyTorchnilmtk_contrib.torch.ResNet_classificationResidual NILM model with classification branchResidual and NILM classification literatureExplicit threshold and loss-weight parameters are supported
BERTTensorFlownilmtk_contrib.disaggregate.BERTTransformer/BERT-inspired NILM adaptationDevlin et al., BERTDoes not claim NLP-style pretraining
BERTPyTorchnilmtk_contrib.torch.BERTTransformer/BERT-inspired NILM adaptationDevlin et al., BERTDoes not claim NLP-style pretraining
ConvLSTMPyTorchnilmtk_contrib.torch.ConvLSTMConvLSTM-inspired NILM adaptationShi et al., ConvLSTMGeneric spatiotemporal architecture adapted to NILM
TCNPyTorchnilmtk_contrib.torch.TCNGeneric TCN sequence-modeling baseline adapted to NILMBai, Kolter, and Koltun, TCNPyTorch backend
ReformerPyTorchnilmtk_contrib.torch.ReformerReformer-inspired NILM adaptationKitaev, Kaiser, and Levskaya, ReformerEfficient Transformer architecture adapted to NILM
MSDCPyTorchnilmtk_contrib.torch.MSDCNILM paper implementation requiring experiment validation for new claimsMSDC dual-CNN NILM paperCanonical CRF-enabled implementation path
MSDC without CRFPyTorchnilmtk_contrib.torch.msdc_without_crf.MSDCMSDC ablationMSDC paper/source implementationNo-CRF ablation, not the canonical MSDC path
NILMFormerPyTorchnilmtk_contrib.torch.NILMFormerNILMFormer implementation requiring experiment validation for new claimsPetralia et al., NILMFormerPyTorch backend

Reference Papers And Codebases

NILM-specific references:

Generic architecture references:

Reference repositories:

Usage

The sample notebooks under sample_notebooks demonstrate the NILMTK rapid experimentation API used by NILMBench2026. Install the relevant backend extra and ensure datasets are available before running them.

Supported experiment workflows include:

  • NILMBench2026 benchmark runs across accuracy, event-detection, efficiency, and generalization metrics.
  • Training and testing across multiple appliances.
  • Training and testing across multiple datasets for transfer learning.
  • Training and testing across multiple buildings.
  • Training and testing with artificial aggregate.
  • Training and testing with different sampling frequencies.