-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrunMajorityOnAllShapes.m
More file actions
67 lines (50 loc) · 1.79 KB
/
runMajorityOnAllShapes.m
File metadata and controls
67 lines (50 loc) · 1.79 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
60
61
62
63
64
65
66
67
% Run the majority vote on all shapes, after filtering out the 20% worst
% users
clear all; close all;
% Load the dataset
load dataset.mat
% Load the quality scores for each team
load QualityScores.mat
if ~exist('Results')
mkdir('Results')
end
if ~exist('Results/Majority')
mkdir('Results/Majority')
end
% We want to discard the 20% worst users; we compute the quality threshold
% below which we filter out users
scores_filt = scores(~isnan(scores)); % Remove the NaN users
scores_sorted = sort(scores_filt,'ascend');
score_threshold = scores_sorted(round(20*length(scores_sorted)/100));
% Browse each shape
for ind_shape=1:length(shape)
% disp(int2str(ind_shape))
% Read JSON
s = readJSON(['JSON/' shape{ind_shape,2}]);
% find all annotations for this shape
ind_annot = triplets(triplets(:,2)==ind_shape,3);
shape_annot = annotations(ind_annot);
% find all users for this shape
ind_usr = triplets(triplets(:,2)==ind_shape,1);
% Get these users scores
scores_usr = scores(ind_usr);
% Filter users that are below the score threshold
shape_annot = shape_annot(scores_usr>score_threshold);
% Check whether annotations are of the same size. Some annotations were
% badly saved in our database. We will just discard them.
good = 1;
for ind=1:length(shape_annot)-1
if (length(shape_annot{ind})~=length(shape_annot{ind+1}))
good = 0;
end
end
if (good==1)
% Compute majority vote
majority = computeMajority(shape_annot);
% Save results into the right folder
save(['Results/Majority/' shape{ind_shape,2}(1:end-4) 'mat'],'majority');
% Clear all relevant variables
clear majority
end
clear s ind_annot shape_annot ind_usr scores_usr good
end