double function ( Function < Triple < GeneralDataset < L , F > , GeneralDataset < L , F > , SavedState > , Double > arg0 ) { double loc0 = 0 ; Iterator < Triple < GeneralDataset < L , F > , GeneralDataset < L , F > , SavedState >> loc1 = iterator ( ) ; while ( loc1 . hasNext ( ) ) { loc0 += arg0 . apply ( loc1 . next ( ) ) ; } return loc0 / 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 do n't have to use the saved state if you do n't want to . concode_field_sep int iter concode_elem_sep SavedState[] savedStates concode_elem_sep Object state concode_elem_sep GeneralDataset<L,F> originalTrainData concode_elem_sep int kfold concode_field_sep Triple<GeneralDataset<L,F>,GeneralDataset<L,F>,SavedState> next concode_elem_sep Iterator<Triple<GeneralDataset<L,F>,GeneralDataset<L,F>,SavedState>> iterator concode_elem_sep boolean hasNext concode_elem_sep void main concode_elem_sep void remove