# Prediction Interval Adjustment for Load-Forecasting using Machine Learning
## 3 Materials and Methods
### Association Rules Extraction
#### 3.3.1 Data Discretization  
Numeric data is difficult to use in the _a priori_ algorithm, so a discretization method is needed. In this paper, the discretization of data is made through the method described in [30], specifically, the type 7 quantile method. The discretization method is carried out as follows:  
Let \(Q_{7}(P)\) be the type 7 quantile of the probability \(P\in\{0.1,0.2,\ldots,1\}\):  
\[Q_{7}(P)=(1-\gamma)\cdot x_{(j)}+\gamma\cdot x_{(j+1)} \tag{5}\]  
where \(x_{(j)}\) is the _j_th order statistic of \(x\), \(n\) is the sample size, \(j=\lfloor n\cdot P+m\rfloor\) and \(\gamma=n\cdot P+m-j\) and \(m=1-P\). In this paper, \(X=\{d_{1}\cup V_{t}|V_{t}\in d_{i};\ i\in\{2,3,\ldots,m\}\}\). Using Equation (5) in the set \(X\), we can obtain the bins for data discretization. In Table 2, the obtained bins and quantiles are shown.  
The last row of Table 2 indicates the bins correspondent to the quantiles above them. Specifically, above every Bin, there is its lower and upper limit. Every value of set \(X\) is mapped according to its correspondent bin, so if a value falls inside the range of a bin, that value is substituted with the bin number and stored in a dataset \(L^{*}\). Therefore, using the dataset \(L^{*}\) we can construct the transactional dataset \(D_{Trans}\) as follows:  
Let \(L^{*}\) be set of quantile mapped load measurements:  
\[L^{*}=\{V^{*}_{1},V^{*}_{2},\ldots,V^{*}_{n^{*}}\} \tag{6}\]  
where \(n^{*}\) is the number of observations in \(L^{*}\).  
Let \(D_{Trans}\) be the set of delayed of the quantile mapped time series :  
\[D_{Trans}=\{d^{*}_{1},d^{*}_{2},\ldots,d^{*}_{m^{*}}\} \tag{7}\]  
where \(m^{*}=n^{*}-s\) and \(d^{*}_{i}\) is defined as follows:  
\[d^{*}_{i}=\{V^{*}_{j}\in L^{*}\,|\,j\in\{t-s,\ldots,t-2,t-1,t\}\} \tag{8}\]  
where \(t=i+s\).  
For every \(d^{*}_{i}\), \(r^{*}_{i}=V^{*}_{t}\) represents the right part of the rule, and \(l^{*}_{i}=\{V^{*}_{t-s},\ldots,V^{*}_{t-2},V^{*}_{t-1}\}\) represents the left part of the rule. Also, every \(d^{*}_{i}\) is paired to its correspondent period \(p\in\{1,2,\ldots,96\}\). The rule extraction process is carried out in \(D_{Trans}\) using the _a priori_ algorithm. In this paper, the parameters for the _a priori_ algorithm are set so as obtaining rules with minimum \(support=0.1\) and \(confidence=0.9\) (In some periods where rules were not found, \(support<0.1\) was used). The period element of the transactions dataset is used to segment the data into 96 subsets, one for every period. Then, the _a priori_ algorithm is applied on each subset to obtain a ruleset \(rs\) for every subset. As a result, 96 rulesets were obtained and stored in a dataset \(R\) (\(rs_{p}\in R|p\in\{1,2,\ldots,96\}\)). In Figure 10, a graph of the distribution of the support value per period is shown. Every period distribution is represented as a box plot in which inside the box there is the 95% of the support values in period \(p\).  
The process of prediction interval adjustment using the rulesets contained in \(R\) is explained in the next section.  
\begin{table}
\begin{tabular}{c|c c c c c c c c c c} \hline
**0\%** & **10\%** & **20\%** & **30\%** & **40\%** &