% below are the load commands for different databases
% depending on which database you would like to be processed
% just uncomment the related lines


allMyDatasets = {'albrecht','coc81','desharnais','isbsg_clientserver','isbsg_standalone','maxwell','nasa93'};

for datasetCounter = 1:7
    cd 'adamData';
    eval(['load ',char(allMyDatasets(datasetCounter)),'.csv;']);
    eval(['dataset = ',char(allMyDatasets(datasetCounter)),';']);
    eval(['clear ',char(allMyDatasets(datasetCounter)),';']);
    cd ..;
    
    % train is the dataset minus the selected row
    train = dataset;
    
    % now start predictions
    % the one below -treeK- is our guy to defend
    [myTree, myRoot] = simpleGACGenerator(train);
    
    % prune high variance sub-trees and store the instances in low variance
    % sub-trees
    [cleanedSelectedInstances] = gacPruner(myTree, myRoot);
       
    % save instances
    cd 'adamData';
    eval(['csvwrite(''',char(allMyDatasets(datasetCounter)),'_reduced.csv'',cleanedSelectedInstances);']);
    cd ..;
    
end

