Quantum support vector machine for forecasting house energy consumption: a comparative study with deep learning models

The Smart Grid operates autonomously, facilitating the smooth integration of diverse power generation sources into the grid, thereby ensuring a continuous, reliable, and high-quality supply of electricity to end users. One key focus within the realm of smart grid applications is the Home Energy Management System (HEMS), which holds significant importance given the fluctuating availability of generation and the dynamic nature of loading conditions. This paper presents an overview of HEMS and the methodologies utilized for load forecasting. It introduces a novel approach employing Quantum Support Vector Machine (QSVM) for predicting periodic power consumption, leveraging the AMPD2 dataset. In the establishment of a microgrid, various factors such as energy consumption patterns of household appliances, solar irradiance, and overall load are taken into account in dataset creation. In the realm of load forecasting in Home Energy Management Systems (HEMS), the Quantum Support Vector Machine (QSVM) stands out from other methods due to its unique approach and capabilities. Unlike traditional forecasting methods, QSVM leverages quantum computing principles to handle complex and nonlinear electricity consumption patterns. QSVM demonstrates superior accuracy by effectively capturing intricate relationships within the data, leading to more precise predictions. Its ability to adapt to diverse datasets and produce significantly low error values, such as RMSE and MAE, showcases its efficiency in forecasting electricity load consumption in smart grids. Moreover, the QSVM model’s exceptional flexibility and performance, as evidenced by achieving an accuracy of 97.3% on challenging datasets like AMpds2, highlight its distinctive edge over conventional forecasting techniques, making it a promising solution for enhancing forecasting accuracy in HEMS.The article provides a brief summary of HEMS and load forecasting techniques, demonstrating and comparing them with deep learning models to showcase the efficacy of the proposed algorithms.


Introduction
The primary difference in design between the Smart Grid (SG) and the conventional Power Grid is rooted in their operational orientations.The SG operates on a demandfollows-supply model, while the traditional grid operates on a supply-follows-demand model [1].Renewable energy sources, particularly solar and wind power generation, are extensively integrated into both utility and consumer grids.Many countries are actively transitioning toward the deployment of smart homes and smart grids [2] to leverage their environmental and societal benefits.Advancements in communication technologies and state-of-the-art technologies have paved the way for the development of smart homes, which comprise intelligent appliances, sensors, and meters interconnected via Internet-of-Things (IoT) devices [3].This trend has led to the deployment of home energy management systems (HEMSs) to facilitate the progression towards future smart grids.Additionally, energy users' implementation of Demand Response (DR) programs [4,5] aids in optimizing energy utilization to enhance power reliability and grid efficiency.
Forecasting, estimation, and prediction are crucial in determining future energy demand.Effective energy distribution planning relies on accurate forecasting to balance demand and supply [6].Inaccuracies in forecasting can significantly impact operational costs, network safety, and service quality.Underestimating energy usage can cause power outages, resulting in economic costs and disrupting societal routines.On the other hand, overestimating energy demand can lead to unused capacity, wasting resources, especially financially [7].Therefore, developing models to predict energy consumption trends with nonlinear data is a critical challenge for power generation and distribution networks.
Forecasting models are generally categorized as quantitative or qualitative.Quantitative models are based on data and statistics, while qualitative models rely on experience, judgment, and knowledge.The majority of forecasting methods [8] fall into causal or historical databased methodologies.Causal methodologies analyze the cause-and-effect relationship between energy consumption and input variables such as social, climate, and economic aspects.Common methods for forecasting power consumption include Artificial Neural Networks (ANNs) [9,10] and regression models [11] as shown in Fig. 1.Historical data-driven methods such as time series, auto regression and grey prediction models are also utilized.
Long-term energy consumption studies [12], typically spanning 5 to 20 years, focus on resource management and development programs.Short-term forecasting, ranging from an hour to a week, is commonly employed for scheduling and distribution network analysis [13], whereas mid-term forecasting, covering a month to 5 years [14], is used for planning power production resources and rates.Due to the influence of variables like time, climate, socioeconomic, and demographic factors on energy demand, accurately forecasting energy consumption is both crucial and challenging.
HEMS plays a critical role in regulating power flow within the smart grid, with a primary goal of reducing electricity costs and enhancing energy efficiency and security [15].This heavily depends on the integration of sensing, communication, and control technologies.Communication networks like Wide Area Network (WAN), Home Area Network (HAN), and Neighborhood Area Network (NAN) enable access to energy demand data, allowing control of diverse components such as sensors, Renewable Energy Sources (RES), water meters, and Electric Vehicles (EV).Smart meters serve as intermediaries between the central controller of HAN and the utility, gathering data from multiple HANs and transmitting it to the utility administrator for decision-making based on system parameters.Mathematical optimization, metaheuristic, and heuristic methods are typically used to schedule home energy usage.
A variety of techniques, including data mining, steadystate simulation, and Bayesian networks, are employed to forecast energy demand for building energy consumption, household appliance power, and overall home energy consumption.Researchers have proposed models for forecasting energy consumption across industrial, domestic, non-industrial, commercial, public illuminating, and entertainment sectors, analyzing electricity consumption and heat use to predict distribution system planning.

Organisation
This paper addresses the challenges of load forecasting in Home energy management system(HEMS).In Literature survey section, the literature survey explores various algorithms incorporating prediction analysis.Methodology section presents the implementation of the proposed QSVM approach, illustrated through a flow chart.The results and analysis of the proposed approach are presented in Methodology section.To conclude, Results section summarizes the current state of research, emphasizing the focus on enhancing accuracy in recent studies.

Literature survey
Prediction analysis is an essential component of home energy management systems due to its ability to forecast and anticipate energy usage patterns, allowing for more efficient resource allocation and consumption management.By analyzing historical energy usage data, weather patterns, and household occupancy trends, prediction analysis can accurately predict future energy demands.This information empowers homeowners to make informed decisions regarding energy usage, optimize the scheduling of appliances and heating/cooling systems, and even explore opportunities for renewable energy integration.Ultimately, the implementation of prediction analysis in home energy management systems is crucial for maximizing energy efficiency, reducing costs, and contributing to a more sustainable and environmentally conscious lifestyle.
In the early stages, prediction analysis primarily relied on basic statistical models to forecast energy usage.Zhang et al. [16] discusses a model predictive controlbased home energy management system for a residential microgrid, which takes into account time-varying information such as load demand, electricity price, and renewable energy generations.Using mixed-Interger linear programming three case studies are conducted to analyze the impacts of different factors on the system.Mrazek et al. [17] also proposes a simplified model of a home that uses a 5-day weather forecast to predict energy demands and generation by photovoltaic panels, which can be used for predictive optimization in energy usage.The implementation and validation of modeling methods for forecasting PV, PEV, HP, and home load demand in a home energy management system has been discussed in [18].A Comparitive analysis of stochastic modeling methods which shows sandia model has better performance and accuracy.Similarly, [19] presents a chance constrained, model predictive control algorithm for demand response in a home energy management system.The proposed control architecture ensures both the DR event and indoor thermal comfort are satisfied with a high probability.
Basic statistical models , while useful in certain contexts, have several drawbacks that limit their effectiveness in the realm of prediction analysis for home energy management systems.These models often rely on simplifying assumptions that may not fully capture the complexity and variability of real-world energy consumption patterns.Additionally, basic statistical models may struggle to account for non-linear relationships and interactions among various factors impacting energy usage, leading to less accurate predictions.Moreover, these models typically require manual updating and recalibration to adapt to changing conditions, making them less dynamic and responsive to real-time changes.
However, with the advent of smart home technology, machine learning, and artificial intelligence, the capabilities of prediction analysis have expanded dramatically.A data analysis approach has been proposed in [20] for predicting appliances power state in a home energy management system.Multitarget classification framework was developed for identifying power state of appliances which Outperforms FHMM and binary state modeling framework in power prediction.Load forecasting methods using machine learning for HEMS has been proposed in [21] using DBSCAN, K-means, and PCC algorithms which helps in improving the stability and reliability of HEMS.Supervised-based machine learning algorithms such as Linear Regression, Lasso Regression, Random Forest, Extra Tree Regressor, XG Boost are used in [22] for prediction of household energy consumption.The comparision of these models shows that the tree based models such as Random Forest and Extra Tree Regressor, gave the best results.Syamala et al. [23] explores deep learning-based techniques for predicting energy consumption in smart residential buildings, which is essential for home energy management systems.Deep learning models are optimal for estimating prediction performance and uncertainty.Method of machine learning with reinforcement in [24] is effective in predicting the costs.Evaluation of effectiveness and reliability of forecasting has done accurately.Although ML and DL models are performing well in predictions analysis but there are certain limitations.One of the main drawbacks is their computational intensity and resource requirements.Deep learning models often require significant computational power and substantial training time, which can be a limiting factor in practical applications, especially in resource-constrained environments.Additionally, deep learning models can be complex and challenging to interpret, leading to potential difficulties in understanding the underlying factors driving predictions and decisions.They may also require large amounts of labeled data for training, which can be difficult to acquire in certain domains.
In this paper sophisticated algorithms are used that can analyze vast amounts of data, including historical energy consumption, weather patterns, and even individual user behavior, to generate highly accurate predictions which will ovecome the drawbacks of previous methods.Furthermore, the integration of predictive analytics with IoT (Internet of Things) devices has allowed for real-time monitoring and adaptive energy management, enabling homeowners to make proactive adjustments based on dynamic conditions (Table 1).

Problem statement
Accurate load forecasting is essential within Home Energy Management Systems (HEMS) to effectively manage energy consumption.This need arises from the constantly changing energy demands within households.Without precise load forecasting, HEMS struggles to anticipate and adjust to these fluctuations, resulting in inefficient energy use, potential grid instability, and higher expenses.Therefore, a reliable load forecasting mechanism is critical for HEMS to efficiently allocate and manage energy resources, improve overall efficiency, and promote sustainability within the home energy ecosystem.The work presented in this article utilizes Quantam Support Vector Machine (QSVM) for forecasting energy consumption based on a complex AMPD2 dataset encompassing the energy usage of a house.

Key contributions
1. Collecting the data of overall energy consumption as well as different home appliances energy consumption data.2. A Quantum Support Vector Machine(QSVM) approach based on evolutionary learning is introduced for accurately forecasting dynamic short-term load demand and power consumption, particularly improving precision for home energy management.

Support vector machine
The Support Vector Machine (SVM) is a supervised AI method grounded in statistical learning theory [29], aimed at analyzing data and identifying patterns.It finds application in both data classification and regression analysis for estimating system parameters.Initially introduced by Vladimir Vapnik in 1994, SVM offers notable advantages [30], particularly in scenarios with limited sample sizes or databases, such as time series forecasting [1].The fundamental concept behind utilizing SVM for pattern classification involves several steps.Initially, input vectors are mapped into a feature space, potentially These m j are only considered support vectors if the associated β i > 0 .When training SVM, the decision function may be expressed as (4) In linear non-separable scenarios, SVM employs a nonlinear mapping of the input vector y from the space to a higher-dimensional Hilbert space, dictated by the kernel function.

Quantum support vector machine (QSVM)
Quantum Support Vector Machine (QSVM) is an innovative approach that integrates quantum computing principles with classical machine learning algorithms to enhance computational capabilities and optimize performance.It merges quantum algorithms with the classical SVM framework to handle complex datasets and highdimensional feature spaces efficiently.italso solves optimization problems more effectively compared to classical SVMs, allowing for faster processing and improved accuracy in classification tasks.By employing quantum principles such as superposition and entanglement, Q-SVM can process vast amounts of data in parallel, facilitating quicker analysis and decision-making.Generally, Grover's search algorithm and HHL algorithm are the two algorithms that have been used in implementing QSVM [31].These methods can extract specific properties of m sat- isfying A� z = � n , where A is an M × M matrix and n is a vector of size M × 1 .The computational complexity of traditional SVM algorithm is O[log(γ − 1)poly(MP)] , which is directly proportional to the polynomial in MP, where M represents the dimensions of the data, P denotes the number of training data, and γ signifies accuracy.while comparing the traditional SVM with the QSVM based on the HHL algorithm it shows that the QSVM with HHL algorithm can achieve O[log(MP)] per- formance for both training and testing processes, which helps in exponentially speeding up the calculations.
By employing the least-squares reformulation of the support vector machine (SVM), we can convert both the original SVM conundrum and a quadratic programming issue into the challenge of resolving a linear equation system (5):

Fig. 2 Support vector machine working
In this context, N signifies the R × R ker- nel matrix, where elements are computed as x s , when employing a linear kernel.α serves as a user-defined parameter that regulates the balance between training error and the SVM objective.k represents a vector containing the labels of the train- ing data, and I denotes the identity matrix.Thus, the sole unknown term in this linear equation is the vector j β .Here, both and b are parameters utilized to compute the SVM classifier, which defines the decision hyperplane that segregates the data into two sub-groups.Once the parameters of the hyperplane are established, owing to the linear system solving algorithm, such as the HHL algorithm, a new data point y 0 can be classified accord- ingly (6).
Where y j with j = 1, . . ., N represents the training data; β j is the jth dimension of the parameter β ; w denotes the slope of the hyperplane, which can be derived from the parameter β .The parameter b serves as the offset of the hyperplane, and in this context, it's set to 0. Mathematical representation of signum function is shown in (7):

Dataset
Data was gathered on a home that was built in the Greater Vancouver metropolitan area of British Columbia in 1955.Following major renovations in the years 2005 and 2006, the house was awarded an Energy Guide 23 rating of 82% by the Canadian government, an (5) increase from 61%.The house is located in Vancouver, East's Burnaby neighbourhood.AMPds2 is available for download in various formats, including the original CSV files, RData, and tab-delimited formats, through Harvard Dataverse (Data Citation 2).AMPds2 includes a description of the house file's electricity use.The four distinct categories of AMPds2 data are electricity, water, natural gas, and climate [32].In this work, the prediction analysis was conducted using the electricity dataset.for example data about power billing would be included in a Electricity billing.csvfile.Data on electricity from the clothes dryer (CDE) metre would be stored in Electricity CDE.csv file.
The home is supplied with the 240 V, 200A service by BC Hydro, a provincial utility.Two DENT PowerScout 18 devices measuring 21 loads of data were recorded during a two-year period (2012-2014).Every minute, twenty-one loads of data were captured.The load details for the 21 loads are shown in Fig. 3. Since no activity was detected, three loads were disconnected: a gas stove plug breaker, a microwave plug breaker, and a randomly selected lighting breaker.Low-value measurements were made and recorded as zero.

Data preprocessing
Data Scaling is a fundamental data preprocessing procedure applied to numerical features.Several machine learning algorithms have been implemented to achieve optimal outcomes.Most commonly used scaling methods such as standard scalar, Minmax scalar have been used [33].In the analysis of the AMPD2 dataset, this article has employed the MinMaxScaler.MinMax scaling, also known as min-max normalization, is a data preprocessing method used to adjust numerical features in a dataset to a specific range, usually between 0 and 1.This technique is valuable in machine learning and data analysis when the features exhibit varying scales and need to be standardized for consistent comparison and model training.The MinMax scaling process involves the following steps: Here, scaled x scaled scaled denotes the scaled value of x, min(x) represents the minimum value of feature x, max(x) signifies the maximum value of feature x, while min and max are the desired minimum and maximum values of the range, typically 0 and 1. Formula (8) linearly scales each feature's values to the desired range.

QSVM implementation
This section comprises two parts, in the first part AMPDs2 dataset is transformed(encoded) into a quantum state using a basic embedding, which translates each data point from its original representation to a superposition state on the quantum states (9) as shown in Fig. 4.
Here, |y� represents a classical input data vector which is transformed into a quantum state |ϕ(y)� through apply- ing a unitary operator Z(y)|0� to its initial quantum state |0�.
Then the subsequent operations in the layer, we utilized Hadamard gates and CNOT gates act as a feature mapping.They manipulate the initial basis states, creating entanglement between qubits and generating a more complex quantum state that captures higher-order relationships and features from the input data.This feature mapping effectively transforms the original data into a (8) new, quantum-based feature space, where the similarity between data points is measured by the inner product of their resulting quantum states.And the second part we employed square kernel matrix, which captures the similarities between pairs of data points not only in their quantum feature representation at a single point in time, but also across different time steps.This allows us to analyse the past history of the data and identify patterns that can inform future predictions.

Results
This study makes use of the AMPds2 dataset, which consists of 21 different loads with irregular consumption patterns.Figure 5 provides a detailed overview of the consumption patterns of the loads.Several artificial intelligence techniques, such as basic RNN, LSTM and QSVM, are used to forecast energy usage.Various combinations of activation functions and hyperparameters are used to train these models.The RMSE and MAE measures are used to evaluate each model's performance.
In Python code, the data is resampled on a weekly basis before undergoing data preprocessing.Following the resampling process, the data is subjected to data preprocessing procedures.Subsequently, the processed data is then fed into the different models for further analysis and modeling.

Deep learning models (LSTM & RNN models)
The study advocates for the utilization of Deep Learning techniques, which involve modifying and resizing the dataset to meet the requirements of the neural network (NN) model.Initially, the research employs an RNN model, comprising one input layer, two output layers, and two hidden layers, each containing 40 nodes.With a total of 5362 trainable parameters and 0 non-trainable parameters, the RNN model undergoes data splitting for training, allocating 30% for validation purposes.Subsequently, the trained model is evaluated using separate test data to forecast future values, with focused adjustments made to

Proposed methodology
The AMPD2 dataset is resampled, normalized, and discretized into binary data using a specified threshold value.The binary information is divided into input sequences and their respective output targets.This study focused on assigning a certain number of time steps to each sequence using 2, 4, and 8 qubits, as shown in Fig. 8.
For validating the proposed QSVM model effectiveness by employing 2, 4 and 8 qbits.Subsequently, the data is processed through a quantum circuit ansatz where it is encoded, followed by the application of layers of Hadamard (H) gates and CNOT gates to create entanglement (R z (θ)) between the qubits (ZZ(θ)) , where θ is rotated by π 2 .Following this, the data is split into 70% for training and 30% for testing.A quantum kernel is utilized to compute the inner product of quantum feature maps of the training samples.These quantum feature maps (x 1 .x 2 ) are applied to the ansatz circuit to calculate the probability of observing the measurement, indicating the inner product.Finally, a traditional SVM is trained using the quantum kernel, and the QSVM model is then employed to forecast the testing data.The prediction analysis using QSVM is shown in below Fig. 9.
In this study, we compared the performance metrics of different qubits in the proposed model.Specifically, we utilized 2, 4, and 8 qubits to assess the effectiveness  2 indicate that the employment of 2 qubits resulted in lower RMSE (0.144), MAE (0.380), and MAPE (0.256) compared to the results obtained with 4 and 8 qubits.The prediction accuracy of 2 qubits is notably higher at 97.36%, surpassing the slightly lower prediction accuracies of 93.12% and 90.76% observed with 4 and 8 qbits, respectively.
When comparing the proposed method with deep learning models in terms of performance metrics, it becomes evident that the Quantum Support Vector Machine (QSVM) demonstrates superior performance.This is highlighted by a comparative analysis of root mean square error (RMSE), mean absolute error (MAE), and MAPE, as depicted in the Table 3. Figure 10 illustrates the comparison of results achieved by the proposed model showing an accuracy of 97.36%.In contrast, both LSTM and RNN achieved slightly lower accuracies of 95.01% and 93.9%, respectively.The data unequivocally indicates that QSVM outperforms deep learning models across these key performance indicators, affirming its efficacy in handling the specific task at hand.

Conclusion
This article emphasizes the role of forecasting in Home Energy Management Systems (HEMS) of smart grids.Using deep learning techniques including Recurrent Neural Networks (RNN), Long Short-Term Memory (LSTM), and Quantum Support Vector Machine (QSVM) for electrical load consumption prediction, it investigates the application of QSVM to forecast complex electricity consumption patterns.The comprehensive performance evaluation of the article highlights the excellent results with significantly low values for both RMSE and MAE.In instance, the QSVM model exhibits low RMSE (0.14) and MAE (0.380) values, demonstrating its great accuracy.These results are typically applicable, even if they may not be true for all datasets.Furthermore, the selection of a time series forecasting model has a substantial impact on error reduction.It is most useful to use a highly adaptive model, especially when working with complicated and nonlinear datasets.The QSVM approach produces the best accuracy, as demonstrated by our study and documented in the literature, with an improvement of about 3%.Attaining an accuracy of 97.3% on a complicated dataset such as AMpds2 highlights the model's exceptional flexibility.Moreover, future studies could delve into the generalizability of the QSVM approach and its adaptability to different datasets.Investigating its performance across various types of data would provide valuable insights into the robustness of the model and its applicability in realworld scenarios.This could involve exploring the impact of various external factors and contextual variables on the accuracy and reliability of the QSVM approach.
Additionally, researchers might consider conducting comparative studies to evaluate the performance of the QSVM model against other advanced forecasting models, particularly in the context of complex and nonlinear datasets.Comparisons with existing state-of-the-art models could yield essential benchmarks for understanding the relative strengths and weaknesses of different approaches, ultimately guiding the selection of the most suitable forecasting model for specific applications.
Furthermore, future research could focus on developing hybrid models that integrate the strengths of multiple forecasting techniques, potentially addressing the limitations of individual models and enhancing overall prediction accuracy.This could involve exploring innovative combinations of deep learning approaches and traditional forecasting methods to harness the complementary advantages of each approach, thus pushing the boundaries of forecasting precision and adaptability.
By delving into these areas, future studies could further expand the understanding of forecasting in HEMS of smart grids, paving the way for enhanced accuracy, adaptability, and real-world applicability of forecasting models in the realm of energy management.

Table 1
Literature survey on load forecasting in HEMS By minimizing the Euclidean norm of || c || under this constraint, SVMs solve a convex quadratic problem (QP) by introducing Lagrange multipliers β i .The solution yields a globally optimized result with specific properties (3).

Table 2
Comparing the different metrics of various qbits of proposed model

Table 3
Overall comparision of proposed models Fig. 10 Comparision of Different prediction models