This article investigates the use of machine learning models for forecasting energy consumption in urban environments. The study evaluates multiple regression and ensemble learning models, including Random Forest, Gradient Boosting, Linear Regression and Support Vector Regressor, across three datasets representing Tetouan, Morocco, Brazilian regions and French households. The models are assessed using RMSE, MAE and R², with results indicating that ensemble methods, especially Random Forest and Gradient Boosting, show strong performance in capturing non-linear energy consumption patterns.