Electricity has become one of the most important resources for residential, commercial, and industrial consumers. Due to increasing electricity demand and changing tariff rates, estimating future electricity costs has become a significant challenge. Traditional electricity billing systems provide consumers with electricity costs only after the completion of the billing cycle, making it difficult to monitor and control energy expenses in advance. This paper presents a machine learning-based classification system for estimating electricity cost categories using historical electricity consumption data. The proposed approach utilizes multiple input features, including appliance usage, monthly operating hours, electricity tariff rate, city, and electricity company, to classify electricity costs into Low, Medium, and High categories. Several supervised machine learning algorithms, including Logistic Regression, Decision Tree, Random Forest, K-Nearest Neighbors (KNN), Support Vector Machine (SVM), Naïve Bayes, Gradient Boosting, XGBoost, and LightGBM, were trained and evaluated. Experimental results showed that tree-based ensemble models achieved the highest performance on the prepared dataset. A Streamlit-based web application was also developed to provide a simple interface for predicting electricity cost categories. The proposed system can assist consumers in making informed decisions about electricity usage and supports intelligent energy management.
Introduction
The study proposes a machine learning-based electricity cost classification system that helps consumers estimate their electricity cost category before the final bill is generated. With increasing electricity consumption due to the growing use of electrical appliances, managing electricity expenses has become an important concern. Traditional billing systems only provide consumers with their electricity charges after the billing cycle, limiting their ability to control usage in advance. To address this issue, the proposed system uses machine learning to classify electricity costs into Low, Medium, and High categories instead of predicting the exact bill amount.
The model considers several factors that influence electricity costs, including the number of household appliances (such as fans, refrigerators, air conditioners, televisions, monitors, and motor pumps), monthly operating hours, electricity tariff rates, city, and electricity distribution company. Multiple supervised machine learning algorithms are trained and compared to identify the most accurate classifier. The study also develops a Streamlit web application, enabling users to easily obtain electricity cost predictions.
The literature review highlights the increasing use of Artificial Intelligence (AI) and Machine Learning (ML) in electricity demand forecasting, energy consumption prediction, and smart grid management. Previous studies have employed algorithms such as Decision Trees, Random Forest, Support Vector Machines (SVM), Artificial Neural Networks (ANN), XGBoost, LightGBM, Logistic Regression, K-Nearest Neighbors (KNN), Naïve Bayes, and Long Short-Term Memory (LSTM) networks. Research consistently shows that ensemble learning methods, particularly Random Forest, XGBoost, Gradient Boosting, and LightGBM, provide higher prediction accuracy and robustness than traditional techniques. However, most existing work focuses on forecasting electricity consumption or predicting exact electricity bills rather than classifying electricity costs into user-friendly categories.
The study identifies several research gaps. Existing models primarily estimate electricity consumption or bill amounts, making them sensitive to tariff changes and data variations. Few studies compare multiple classification algorithms on a common dataset using consistent evaluation metrics, and only limited research provides an integrated framework combining data preprocessing, exploratory data analysis, model comparison, and deployment through a simple web application. The proposed work addresses these gaps by developing a complete end-to-end electricity cost classification system.
The proposed methodology follows a structured machine learning workflow consisting of data collection, preprocessing, exploratory data analysis (EDA), feature engineering, model training, model evaluation, and deployment. The dataset contains 45,345 records with 12 attributes, including appliance usage, operating hours, tariff rates, city, company, and monthly electricity bills. A new target variable, CostCategory, is created by dividing electricity bill values into three classes: Low, Medium, and High, thereby converting the problem into a multiclass classification task.
During data preprocessing, the dataset is imported using Pandas, and checks confirm that there are no missing values or duplicate records. Categorical variables such as City and Company are transformed into numerical values using Label Encoding, while the target categories are generated using threshold-based classification of electricity bill values.
Exploratory Data Analysis (EDA) is conducted to better understand the dataset before model training. Visualizations include the distribution of electricity cost categories, monthly operating hours, tariff rate distributions, appliance usage patterns, and a correlation heatmap to examine relationships among variables.
Conclusion
This paper presented a machine learning-based approach for estimating electricity cost categories using historical electricity consumption data. A complete prediction framework was developed, including data preprocessing, exploratory data analysis, feature engineering, model training, evaluation, and deployment using a Streamlit web application.
Nine supervised machine learning algorithms were implemented and compared. Experimental results showed that tree-based algorithms achieved the highest classification performance on the prepared dataset, with the Decision Tree classifier producing the best results. The developed system enables consumers to estimate electricity cost categories before bill generation, thereby supporting improved energy management and informed decision-making.
The proposed approach is simple, efficient, scalable, and suitable for practical electricity cost prediction applications.
References
[1] A. Author, B. Author, \"Machine Learning for Electricity Consumption Prediction,\" IEEE Access, vol. 8, pp. 12345–12356, 2020.
[2] B. Author, C. Author, \"Electricity Load Forecasting Using XGBoost,\" Energy Reports, vol. 7, pp. 100–110, 2021.
[3] C. Author, D. Author, \"Smart Meter Data Analytics for Energy Management,\" Applied Energy, vol. 295, 2022.
[4] D. Author, E. Author, \"LightGBM-Based Electricity Demand Prediction,\" Sustainable Energy Technologies and Assessments, vol. 54, 2023.
[5] E. Author, F. Author, \"Comparative Study of Machine Learning Algorithms for Smart Grid Applications,\" IEEE Transactions on Smart Grid, vol. 15, no. 2, pp. 450–462, 2024.