# Forecasting Electricity Prices: A Machine Learning Approach
## 3 Method  
Genetic programming (GP) [34] is a method that belongs to the computational intelligence research area called evolutionary computation. GP consists of the automated learning of computer programs by means of a process inspired by [PERSON]'s theory of biological evolution. In the context of GP, the word _program_ can be interpreted in general terms. Thus, GP can be applied, for instance, to learning expressions, functions and, as in this work, data-driven predictive models. Crucial to GP are the definitions of the representations used to encode the programs and the function used to quantify the program's quality, called an objective function or fitness. Starting from an initial population of programs, which are typically generated at random, the objective of GP is to navigate the space of all programs that can be represented with predefined encoding, searching for the most appropriate programs to solve the problem at hand. Generation by generation, GP stochastically transforms (by means of _genetic operators_) the populations of programs into new populations of possibly more applicable programs. Several different representations exist, but the one most commonly used encodes a solution as a LISP-like tree [34]. Despite its success in solving complex real-world problems [26], traditional syntax-based genetic operators produce new individuals by operating a blind transformation of the parents. In more detail, knowing the output produced by the parent individuals for a set of training observations does not provide useful information on the output that the children will produce. In other words, traditional mutation and crossover operators directly work on the structure of the individuals without considering any information associated with their behavior or, as commonly found in the literature [35], semantics,This fact is counter-intuitive because, from the point of view of the GP practitioner, what matters is the output produced by the individuals on a set of observations. On the other hand, the structure of the solution (i.e., how the solution is represented) generally plays a secondary role. For this reason, recent years have seen rising interest in the definition of genetic operators able to directly act at the semantic level [35]. Among the different semantic methods, the work proposed by [PERSON], [PERSON] [36] made a fundamental contribution to this field, providing the definition of genetic operators (called geometric semantic operators) that, unlike other existing approaches, are able to directly include the concept of semantics in the search process. Geometric semantic operators (GSOs) have proved their suitability for solving real-world problems [35; 37] and have achieved better performance in standard syntax based GP. This competitive advantage is related to the fact that GSOs induce a unimodal fitness landscape on any problem consisting of matching sets of input data into known targets (e.g., supervised learning problems such as regression and classification). According to the theory of fitness landscapes [38], this process improves the ability of GP to find optimal (or near-optimal) solutions. The definitions of semantic crossover and semantic mutation for regression problems is given as follows:  
_Geometric Semantic Crossover (GSC)_ [PERSON], [PERSON] [36]. Given two parent functions \(\mathrm{T}_{1}\), \(\mathrm{T}_{2}\): \(\mathrm{R}^{n}\)\(\rightarrow\mathrm{R}\), the geometric semantic crossover returns the real function \(\mathrm{T}_{\mathrm{XO}}=(\mathrm{T}_{1}\cdot\mathrm{T}_{\mathrm{R}})+((1- \mathrm{T}_{\mathrm{R}})\cdot\mathrm{T}_{2})\), where \(\mathrm{T}_{\mathrm{R}}\) is a random function such that \(\mathrm{T}_{\mathrm{R}}\): \(\mathrm{R}^{n}\rightarrow[0;1]\). To constrain \(\mathrm{T}_{\mathrm{R}}\) when producing values in \([0;1]\), we make use of the sigmoid function \(\mathrm{TR}=1\,/\,(1+\mathrm{e}^{-\mathrm{Trand}})\), where \(\mathrm{T}_{\mathrm{rand}}\) is a random tree with no constraints on the output values. _Geometric Semantic Mutation (GSM)_ [PERSON], [PERSON] [36].