1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
%% Reset everything
clear all;
clc;
close all;
addpath('helpers');
%% Configure the benchmark
% The name of the algorithms in the final plots
names = { '6pt'; 'ge (8pt)'; '17pt'};
% The main experiment parameters
min_outlier_fraction = 0.05;
max_outlier_fraction = 0.45;
outlier_fraction_step = 0.05;
%% Run the benchmark
%prepare the overall result arrays
number_outlier_fraction_levels = round((max_outlier_fraction - min_outlier_fraction) / outlier_fraction_step + 1);
num_algorithms = size(names,1);
mean_number_iterations = zeros(num_algorithms,number_outlier_fraction_levels);
mean_execution_times = zeros(num_algorithms,number_outlier_fraction_levels);
outlier_fraction_levels = zeros(1,number_outlier_fraction_levels);
%Run the experiment
for n=1:number_outlier_fraction_levels
outlier_fraction = (n - 1) * outlier_fraction_step + min_outlier_fraction;
outlier_fraction_levels(1,n) = outlier_fraction;
display(['Analyzing outlier fraction level: ' num2str(outlier_fraction)])
clear number_iterations
clear execution_times
temp_file_name1 = ['number_iterations_' num2str(outlier_fraction) '.mat'];
temp_file_name2 = ['execution_times_' num2str(outlier_fraction) '.mat'];
load(temp_file_name1)
load(temp_file_name2)
%Now compute the mean and median value of the error for each algorithm
for a=1:num_algorithms
mean_number_iterations(a,n) = mean(number_iterations(a,:));
mean_execution_times(a,n) = mean(execution_times(a,:));
end
end
%% Plot the results
figure(1)
plot(outlier_fraction_levels,mean_number_iterations,'LineWidth',2)
legend(names,'Location','NorthWest')
xlabel('outlier fraction')
ylabel('mean number iterations')
axis([0.05 0.25 0 1500])
grid on
figure(2)
hold on
plot(outlier_fraction_levels(1,1:6),mean_execution_times(1,1:6),'LineWidth',2)
plot(outlier_fraction_levels,mean_execution_times(2:3,:),'LineWidth',2)
legend(names,'Location','NorthWest')
xlabel('outlier fraction')
ylabel('mean execution time [s]')
axis([0.05 0.45 0 40])
grid on
|