# Prediction Interval Adjustment for Load-Forecasting using Machine Learning
## 3 Materials and Methods
### Prediction Interval Estimation
#### 3.2.1 Artificial Neural Network Training and Validation  
Artificial Neural Networks (ANN) are models inspired by the central nervous system, which are made of interconnected neurons [23]. One of the most common ANN paradigms for both classification and regression is the Multi-Layer Perceptron (MLP). An MLP artificial neural network is composed of multiple layers of neurons: an input layer, one or more hidden layers, and an output layer. The input layer is responsible for receiving a given input vector and transform it into an output that becomes the input for another layer. A hidden layer transforms the output from the previous layer through a transfer function. Each neuron receives the input from all the neurons in the preceding layer, multiplies each input by its corresponding weight vector and then adds a bias. In this paper, a 3-hidden layer with 11 neurons per layer ANN was implemented.  
We selected 3 hidden layers employing a rule described in [24] and then updated in [25]. The rule indicates that for complex problems, such as time series prediction and computer vision, 3 or more layers are adequate. Also, [24] states three rules to select the number of hidden neurons, for our problem we selected the rule that establishes the number of hidden neurons as 2/3 of the number of the input neurons. Thus, the number of hidden neurons would be \((79/3)\times 2\approx 52\) neurons (17 neurons per layer.). However, in [24] they warn that too many neurons per layer may lead to overfitting, so we still tried to reduce the number of hidden neurons and tested architectures from 17 to 10 neurons per layer, 11 neurons per layer was the one architecture to have similar error rate as 17 neurons per layer in terms of MAE (Means Absolute Error).  
The method for training the ANN models in this paper is the Resilient Backpropagation method described in [26]. Regarding the activation function, despite the existence of several types of activation functions such as linear, tanh, gaussian, etc. the sigmoidal function is conventionally used in time series forecasting, hence, the latter was employed [27]. In Figure 6, a graphical representation of this configuration is shown.  
To train the ANN models, create the prediction intervals, and test the prediction intervals, the total dataset \(D\) was divided into three groups: \(D_{Train}\), \(D_{TrainPI}\) and \(D_{Test}\). \(D_{Train}\) is composed of the first 70% of data, \(D_{TrainPI}\) of the following 20% \(D_{Test}\) of the last 10%. \(D_{Train}\) is divided in 96 subsets in a _80% train-20% test_ format. The elements contained in every \(D_{Train}\) subdivision are sorted randomly. The subdivided \(D_{Train}\) is used to train an ANN model \(a\) per subdivision. As a result, 96 ANN models were obtained and stored in a dataset \(A\) (\(a_{p}\in A|p\in\{1,2,\ldots,96\}\)). In Figure 7, a graphical representation of the Artificial Neural Networks models training is shown.  
Figure 5: Prediction interval modification by means of the \(z\)-_score_.  
In Figure 8, a graphical representation of the training error per ANN model is shown. In the \(x\) axis of the graph, every model is represented with its correspondent time period.  
Once the ANN models were obtained, we proceed to extract the prediction errors using \(D_{TrainP1}\). The following section explains this process.  
Figure 6: A graphical representation of the structure of the Artificial Neural Network used for this work.  
Figure 7: Graphical representation of the Artificial Neural Networks models training.