# Differential Learning for Outliers: A Case Study of Water Demand Prediction
## 4 Predicting Water Demand
Offline training is performed using the data spanning 1997 to 2010. This step is followed by an online training and testing step by using the data from 2011 to 2017. The online training process updates the weights once for each data point (i.e., one epoch for each data point). This approach assumes that the actual water consumption is available at the end of the day. This value is used to update the weights by using Equations (3) and (4) and to predict the next day's water consumption. The model developed using this training approach and the features described above is labeled original model [29]. The predicted water demand produced by the original model compared to the observed water demand for 2015 is shown in Figure 3:0 The online training and testing for the period 2011-2016 produced an average error (\(\tilde{e}\)) of less than 4% as shown in Figure 3:1 In general, the error kept decreasing as the model was trained with data from 2012 to 2016. In the case of the original model, 2017 was not included in the testing period because the income, one of the features of the model, was not available at the time of this publication. Few years in Table 1 show an increase in average error with respect to the previous year. Most of these increases, as will be discussed in Section 5, are due to the number of outlier days in that year. Based on the results in Table 1 and by evaluating the \(IW\) values, feature reduction was performed on the original recurrent neural network model, and the input features with low \(IW\) were omitted. A reduced configuration of the model consisting of four input nodes was created. The input nodes are (1) day of the year as a bitonic function increasing from 1 to 183 during the first half and decreasing from 183 to 1 during the second half of the year; (2) maximum temperature; (3) precipitation as the sum of rainfall and snow and (4) an input bias. The number of hidden nodes in the reduced model was set to 8. The recurrence pattern was maintained and 12 networks, one for each month, were created. The day of the year was normalized with respect to the difference (\(D=182\)) between the maximum and minimum values across the study period by using the following equation:  
Figure 3:2  
where \(\widetilde{x}\) is the normalized value for each data point \(x\). The normalization of the temperature and precipitation is with respect to \(D=5\sigma\) where \(\sigma\) is the standard deviation of the temperature and precipitation, respectively. The predicted output using the reduced model compared to the actual water consumption levels for 2015 is shown in Figure 3:3 Table 1 also shows the average prediction errors for the reduced model over the period 2011 to 2017. The average error for the original model in 2011 is 3.59% whereas it is 3.14% for the reduced model. As in the case of the original model, the average error generally reduces throughout the online training for the reduced model. However, this trend is not consistent for the years 2012 and 2017. In the case of 2012, the deviation from the trend is due to under-consumption during the June-September period as a result of mandatory restrictions. For 2017, the deviation is due to over-consumption during the months of August and September and to under-consumption during the months of November and December. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Year** & **Original Model** & **Reduced Model** \\ \hline
2011 & 3.59 & 3.14 \\
2012 & 4.61 & 3.82 \\
2013 & 3.87 & 3.04 \\
2014 & 3.81 & 3.20 \\
2015 & 3.30 & 2.63 \\
2016 & 3.36 & 1.67 \\
2017 & – & 2.39 \\
**Average** & **3.76** & **2.84** \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Yearly average error (\(\varepsilon\)) for the original and reduced-feature models during the online testing period of 2011–2017 (in percent). Figure 6: Predicted water demand for 2015 by using the original Model.