Introduction The rapid growth of intelligent, data-driven building automation systems presents significant challenges in terms of data privacy, scalability, and heterogeneity across distributed environments. Conventional centralized machine learning approaches require sensitive sensor data to be aggregated in a central server, which raises serious privacy concerns and limits real-time responsiveness. To overcome these issues, this study introduces a unified framework that integrates Federated Learning (FL) and Digital Twin (DT) technologies for privacy-preserving, real-time occupancy detection in smart building systems. Methods The proposed framework employs a Long Short-Term Memory (LSTM) model to capture temporal patterns in multivariate time-series data collected from environmental sensors. Model training is conducted collaboratively across distributed client devices using the Federated Averaging (FedAvg) algorithm, ensuring that raw data never leaves local devices. A personalized fine-tuning stage is incorporated to improve model performance under non-identically distributed (non-IID) data conditions and to enhance local adaptability. The trained model is deployed within a Streamlit-based digital twin platform to enable real-time visualization of occupancy states, sensor behavior, and model predictions, including rolling forecasts, confidence estimates, and error diagnostics. Results The integrated FL–DT framework enables accurate and privacy-preserving occupancy detection across distributed environments while maintaining scalability and adaptability. Personalized fine-tuning significantly enhances local prediction performance and robustness under heterogeneous data conditions. The digital twin interface provides continuous situational awareness through live visualization and analytics, supporting timely decision-making and system-level transparency. Discussion The results demonstrate that combining federated temporal learning with digital twin technology effectively addresses privacy, scalability, and operational challenges in smart building systems. Beyond improving occupancy detection, the framework enables proactive energy management and interpretability through interactive system monitoring. This integrated approach contributes toward the deployment of scalable, secure, and sustainability-aware smart building infrastructures.
Rajaram et al. (Wed,) studied this question.
Synapse has enriched 5 closely related papers on similar clinical questions. Consider them for comparative context: