# Forecasting Electricity Prices: A Machine Learning Approach
## 3 Method
Given a parent function \(\mathrm{T}\): \(\mathrm{R}^{n}\rightarrow\mathrm{R}\), the geometric semantic mutation with mutation step _ms_ returns the real function \(\mathrm{T}_{\mathrm{M}}=\mathrm{T}+\textit{ms}\cdot(\mathrm{T}_{\mathrm{R}1}- \mathrm{T}_{\mathrm{R}2})\), where \(\mathrm{T}_{\mathrm{R}1}\) and \(\mathrm{T}_{\mathrm{R}2}\) are random real functions. Henceforth, we refer to the GP algorithm that uses GSOs as Geometric Semantic Genetic Programming (GSGP). Despite the success of GSGP, an important limitation prevents the use of GSOs in applications where it is important to have a reliable model in a limited amount of time. As shown in different studies [37; 39], GSOs require a large number of iterations before converging towards an optimal solution. On the other hand, considering the application presented in this paper, it is fundamental for an energy market participant to know the predicted price of the energy as soon as possible in such a way that he or she can safely operate over different trading terms. In this study we propose a system that combines GSGP with a local search optimizer, as described by [PERSON], [PERSON] [40]. The idea of combining a local searcher with more exploratory techniques comes from the analysis of evolutionary computation techniques, whose behavior is determined by the exploitation and exploration relationship kept throughout the run [41]. Thus, there is the need for hybrid evolutionary approaches whose main task is to optimize the performance of the direct evolutionary approach (GSGP in this paper). In particular, the hybridization between evolutionary algorithms and local search produces memetic algorithms. Memetic algorithms are orders of magnitude faster and more accurate than evolutionary algorithms for different classes of problems [41]. Despite the potential advantages of these hybrid methods, the use of local searches within geometric semantic genetic programming was fully studied only in a recent contribution [42]. In the context of this work, the use of a local searcher is motivated by the improvement of the convergence speed of GSGP when finding good quality solutions. In this work, we include a local searcher (LS) within the GSM mutation operator. While this is not the only viable option, it is the one that does not produce a significantly negative effect on the execution time of the system. To observe this fact, it is possible to consider (Figure 1) the execution time of standard GP, GSGP, and the proposed system (LSGP) for completing a GP run with 1000 iterations (generations). The running times of GSGP and LSGP are comparable but, as discussed in the following section, LSGP is able to achieve the same accuracy as GSGP by considering only a few iterations. The GSM with LS (LSGSM) is defined as follows: Given an individual \(T\), the LSGSM operator produces a new individual \(T_{M}\) such that \(T_{M=}\alpha_{0}+\alpha_{1}\cdot T+\alpha_{2}\cdot(T_{R1}-T_{R2})\), where \(\alpha_{i}\in R\); here, \(\alpha_{2}\) replaces the mutation step parameter \(ms\) used in the definition of GSM. This formulation defines a basic multivariate linear regression problem that can be solved, for example, by Ordinary Least Square regression (OLS). Hence, after the application of geometric semantic mutation, OLS is applied to the previous expression to obtain the values of the parameters \((\alpha_{0},\ \alpha_{1},\ \alpha_{2})\) that best fit the training instances. As explained by [PERSON], [PERSON] [40], combining the exploration ability of GSGP with the exploitation ability of a local search method allows LSGP to find good quality solutions in a small number of generations while also avoiding the excessive specialization of a model of the training instances and, consequently, overfitting. Thanks to its properties, LSGP provides an efficient tool to energy market participants for the energy price forecasting task.