Skip to Content


IoT & Machine Learning

Introduction :

Information about building occupancy is essential for effective energy management in buildings through the adoption of occupant-centred energy conservation and control strategies. These strategies aim to contribute to the optimisation of energy consumption while ensuring the comfort of occupants. This study focuses on advanced occupancy modelling techniques to improve the energy efficiency of residential buildings, using various data-driven techniques. By employing a Living Lab approach in a residential setting, the research evaluates the model's performance using two ground truth datasets: IoT sensors and survey data.

Problem Statement and Objectives :

In the context of energy transition, residential housing represents a strategic lever, particularly in urban areas where the demand for air conditioning, heating, and hot water is increasing. Conventional energy efficiency approaches (insulation, high-performance equipment) often overlook the impact of occupant behaviour. However, occupants can vary consumption by ±40%, according to numerous studies. The integration of connected objects in Moroccan homes remains limited, often for reasons of cost or lack of knowledge. However, demonstrators such as the Nassim Living Lab in Marrakech show that a suitable, frugal and contextual solution is possible.

Methodology :

In this research, an innovative methodology is presented. It combines data-driven techniques with a knowledge-based system to model occupancy based on integrated IoT sensors and survey data. The proposed model allows not only to determine the occupancy level of the building, but also to ascertain whether the occupied area is actively used or designated as a sleeping area. Instead of considering the entire house as a unit, this approach formulates the occupancy modelling by zone. These systems will be able to determine the occupancy in each zone, and the HVAC system will be operational when there are people in the occupied spaces. This targeted approach minimises energy waste by avoiding unnecessary heating or cooling of unoccupied areas, resulting in significant energy savings over time.

Key Findings :

Prediction of the next day's electricity consumption


This research presents a self-adaptive learning system that uses the LightGBM model in an online learning approach to predict residential electricity consumption the day before. The proposed methodology combines both offline and online machine learning, allowing for real-time adaptability and high performance. Different machine learning models have been compared in this study, demonstrating the effectiveness of ensemble techniques. LightGBM has been identified as the most efficient model, offering superior predictive accuracy, computational efficiency, and low memory usage, making it particularly well-suited for deployment in real-world environments.

Model Comparison

Two main modelling approaches have been developed and examined to gain insights into occupancy: binary modelling and a more comprehensive model. The binary modelling focuses on predicting the overall occupancy state of the building, by determining whether it is occupied or unoccupied. On the other hand, the comprehensive model identifies occupancy and categorises the occupied space into active or sleep zones. This model aims to distinguish specific sub-populations and to accurately capture occupancy differences, while maintaining a rich data depth by delineating three occupancy states.

Binary Model vs Multi-class Model


The results of the study revealed that the models achieved accuracy rates ranging from 70% to 95.96% in predicting the occupancy of the entire building and modelling the occupancy by zone. In particular, the Random Forest model achieved exceptional results in capturing occupancy trends for binary classification using selected features. Moreover, for the multi-classification of occupant states, it consistently outperformed the other models. The integration ofmachine learningand specialised knowledge into the Bayesian network (BN) model improved its capabilities as an explanatory model, allowing for the prediction of various types of occupancy, including general presence, and providing a detailed analysis of the occupancy of active and sleeping areas.


Publications and references


Bouyakhsaine, K., Brakez, A., Draou, M., & Addi, K. (2025). Day-ahead residential power load forecasting using adaptive online learning and Particle Swarm Optimization. Advanced Engineering Informatics68, 103754.


Bouyakhsaine, K., Brakez, A., & Draou, M. (2024). Prediction of residential building occupancy using Machine learning with integrated sensor and survey Data: Insights from a living lab in MoroccoEnergy and Buildings319, 114519.


Bouyakhsaine, K., Brakez, A., & Draou, M. (2023, November). Data-Driven Approach for Residential Occupancy Modeling Using PIR Sensors: A Moroccan Case Study. In 2023 IEEE 6th International Conference on Cloud Computing and Artificial Intelligence: Technologies and Applications (CloudTech) (pp. 01-06). IEEE.


© Copyright 2026 - Nassim Living Lab