public double computeAverage ( Function < Triple < GeneralDataset < L , F > , GeneralDataset < L , F > , SavedState > , Double > function ) { double sum = 0 ; Iterator < Triple < GeneralDataset < L , F > , GeneralDataset < L , F > , SavedState > > foldIt = iterator ( ) ; while ( foldIt . hasNext ( ) ) { sum += function . apply ( foldIt . next ( ) ) ; } return sum / kfold ; }
This computes the average over all folds of the function we re trying to optimize . The input triple contains in order the train set the test set and the saved state . You don t have to use the saved state if you don t want to .