Networkers Home AI Projects

100 beginner machine learning projects with runnable Python code, tests and honest case studies. By Networkers Home, Bangalore.

View the Project on GitHub NETWORKERS-HOME-123/ai-projects

Energy consumption predictor

What this project does

This project trains a simple, reproducible regression baseline to forecast hourly energy consumption for a single aggregate meter. The pipeline demonstrates building lag features, using an as-issued weather input (a forecast column that is not replaced by future true observations), and comparing a trained regression model against a operational baseline: same-hour-last-week demand. The project evaluates chronological mean absolute error (MAE), peak-period errors and holiday-period errors, and emits lightweight warnings for missing-meter readings and stale weather inputs. The project uses a synthetic but realistic hourly dataset created inside the code (see Data section).

Data

The data are synthetic and generated inside the project using numpy and pandas to mimic permissioned aggregate meter readings with calendar context and an as-issued hourly temperature forecast. The dataset contains hourly timestamps for a year plus two weeks, a true consumption value, a forecast temperature column (the as-issued weather used in production), and holiday markers. A small fraction of meter readings and forecast timestamps are marked to trigger the missing-meter and stale-input warnings.

How to build it

  1. Create a Python 3.11+ virtual environment (recommended). Example: python -m venv venv && source venv/bin/activate
  2. Install dependencies: pip install -r requirements.txt
  3. Inspect project.py to see the data-generation, lag-feature creation, model training and evaluation logic.
  4. Run the pipeline with python project.py to print the JSON results.

How to run

Run the project script directly. The script defines run(seed: int = 42) and the main block prints the output JSON:

python project.py

How to test

Tests are provided with pytest. To run the tests:

pytest -q

The tests check presence of keys, reasonable metric ranges, determinism and a conservative main-metric floor.

Results

Limitations

Next steps


Full case study, build steps and evaluation checks: Energy consumption predictor on networkershome.com

Built by Networkers Home · Learn the skills in the AI Engineer Course · Part of 100 AI projects with code