function [algorithmResults] = algorithmRunner(dataset, currentAlgorithm, currentErrorMeasure, currentPreProcessor, isThereGacPruning) % define a variable that will keep the results for each algorithm % initialize cells to -1, at the end all -1's should have been changed algorithmResults = -1 * ones(1,size(dataset,1)); currentAlgorithm = char(currentAlgorithm); % for each test instance % run the algorithm % and store the predictions for i = 1:size(dataset,1) tempDataset = dataset; % copy dataset to protect against deletion testSet = tempDataset(i,:); % select test set/instance actually tempDataset(i,:) = []; % delete selected instance from temp data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% code inside these lines are for gac pruning if pruning was selected if isThereGacPruning == 1 [myTree, myRoot] = simpleGACGenerator(tempDataset); % generate tree % prune high variance sub-trees [trainSet] = gacPruner(myTree, myRoot); else trainSet = tempDataset; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % now start running the algorithms and storing the results if strcmp(currentAlgorithm, 'SWReg') == 1 algorithmResults(1,i) = swRegression(testSet, trainSet); elseif strcmp(currentAlgorithm, 'RuleInd') == 1 algorithmResults(1,i) = ruleInduction(testSet, trainSet); elseif strcmp(currentAlgorithm, '1NN') == 1 algorithmResults(1,i) = OneNN(testSet, trainSet, currentPreProcessor); elseif strcmp(currentAlgorithm, 'NNet') == 1 algorithmResults(1,i) = myNeuralNet(testSet, trainSet); elseif strcmp(currentAlgorithm, 'ABE0') == 1 algorithmResults(1,i) = ABE0(testSet, trainSet, currentPreProcessor); else fprintf('ERROR: NO ALGORITHM WAS SELECTED TO EXECUTE!\n'); end end if (sum(isnan(algorithmResults)) ~= 0) || (sum(isinf(algorithmResults)) ~= 0) problem = 1; end end