# Comparison of Training Approaches for Photovoltaic Forecasts by Means of Machine Learning
## 2 Training Database Composition Approaches  
In order to perform the day-ahead forecast, the ANN needs to be trained. Hence, the amount of historical data employed in the supervised learning determines the ANN forecast capability. This amount of data is formed of samples exploited in the process of identifying the links among neurons in the network which minimize the error in the forecast. In order to do this task, the whole amount of available samples is divided in two groups:  
* the \"training set\" (or equally \"training database\"), which is used to adjust the weights among neurons by performing the forecast on the same samples,
* the \"validation set\", which is used as a stopping criteria to avoid over-fitting and under-fitting. It proves the goodness of the trained network on additional samples which have not been previously included in the training set. The purpose of this step is to test the generalization capability of the neural network on a new data-set. Learning occurs by updating elements within the network; thus, its response iteratively improves to match the desired output. An ANN is trained when it has learned its task and converges to a solution. To achieve this, some learning algorithms are commonly used:  
* error back-propagation (EBP)
* gradient descent
* conjugate gradient
* evolutionary algorithms (genetic algorithms, particle swarm optimization, etc.) Sometimes, according to the problem, the fastest algorithm gives solutions rapidly converging on local minima; however, this does not guarantee the maximum accuracy. In addition, it should be considered that a large training set size provides a better sample of the trends improving generalization, but it generally slows down the learning process. If an ANN is not properly trained or sized, there are usually undesired results, such as \"overfitting\" and \"underfitting\" [26]. Using ANN ensembles by averaging their outputs has been demonstrated to be beneficial, as it helps to avoid chance correlations and the overtraining problem [27; 28]. However, to choose both the most suitable learning algorithm and the proper size of the training set which minimizes the error is a challenge which should be faced in each case study [29; 30; 31]. In this paper, we inspect how the behavior on the day-ahead forecast is influenced by the possible characteristics summarized in Figure 1. The first characteristic of the data-set is either \"incremental\" when the elements belonging to the training data-set are progressively available over time and the training set size gradually increases or \"complete\" if an already existing database of samples is available. The second characteristic refers to the way the data-set is used for training the ANN. As the forecast-making is mainly a stochastic process, the choice could be to use entirely the same training data set for each forecast of the ensemble (we refer to the single forecast with the term \"trial\", and in this case, all the trials will be the same in the ensemble) or to shuffle its elements, grouping them in smaller subsets adopted each time to separately train a different ANN (in this other case, each trial is independent, as all the training data-sets are different). Finally, the mean of the resulting output is usually calculated in the so-called \"ensemble\" forecast. The third characteristic is related to the order of the hourly samples that constitute the training data-set. They can appear either consecutively displaced as the chronological time series they belong to or they can be randomly grouped and mixed up. The combination of these characteristics results in different ANN training methods, which could affect the forecast. All of the assumptions exposed here are valid, in general terms, for all ANN-based methods. In this specific paper, authors employ the Physical Hybrid Artificial Neural Network (PHANN) method for the day-ahead forecast, as described in detail in [14; 21].