This repository was archived by the owner on Jan 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotStrategy.m
More file actions
60 lines (50 loc) · 2.09 KB
/
plotStrategy.m
File metadata and controls
60 lines (50 loc) · 2.09 KB
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
function [effectiveness_mean, efficiency_mean, inspected_publications_mean] = plotStrategy(strategy_name, author_num_citations, num_inspected_publications, num_citations, do_plot)
% plotStrategy - Compute effectiveness and efficiency of the given
% strategies.
%
% Example: plotStrategy('my-strategy', [5,2], [10,5], [7, 2], true)
%
% strategy_name: Name of a strategy
% author_num_citations: Authors number of citations
% num_inspected_publications: Number of inspected publications
% num_citations: Number of citations
% (do_plot): Optional set to true, if a plot should be created
%
% effectiveness_mean: Mean effectiveness
% efficiency_mean: Mean efficiency
% inspected_publications_mean: Mean number of inspected publications
%
if nargin < 4
error('Not enough input arguments.')
elseif nargin < 5
do_plot = false;
end
plot_linewidth = 2;
plot_markersize = 15;
% remove zeros
idx = find(author_num_citations==0);
author_num_citations(idx) = [];
num_inspected_publications(idx) = [];
num_citations(idx) = [];
effectiveness = num_citations./author_num_citations;
%effectiveness(isnan(effectiveness)) = 0;
efficiency = num_citations./num_inspected_publications;
%efficiency(isnan(efficiency)) = 0;
effectiveness_mean = nanmean(effectiveness);
efficiency_mean = nanmean(efficiency);
inspected_publications_mean = nanmean(num_inspected_publications);
fprintf('%f\t%f\t%.2f\t%s\n', effectiveness_mean, efficiency_mean, inspected_publications_mean, strategy_name)
if do_plot
x_axis = 1:length(author_num_citations);
figure(1)
hold on
plot(x_axis, effectiveness, 'linewidth', plot_linewidth, 'markersize', plot_markersize)
%plot(get(gca,'xlim'), [effectiveness_mean effectiveness_mean])
hold off
figure(2)
hold on
plot(x_axis, efficiency, 'linewidth', plot_linewidth, 'markersize', plot_markersize)
%plot(get(gca,'xlim'), [efficiency_mean efficiency_mean])
hold off
end
end