-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmodelE1.m
More file actions
63 lines (49 loc) · 1.25 KB
/
modelE1.m
File metadata and controls
63 lines (49 loc) · 1.25 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
% MODEL E1
% designed to try and implement the "common-sense" suggestion of Endress
% (2013)
%
% possible experiments:
% - marcus1999: ABB, ABA
% - endress2007: ABB, LHM
% - frank2009: uni, multi
% - gerken2006: AAB, AAx, AAx2
% - gerken2010: col, col+5, music+5
% - gomez2002: 2x, 6x, 12x, 24x
% - kovacs2009 (no conditions)
% see manuscript for more details
clear all
addpath('helper')
% parameters
params.expt = 'endress2007';
params.lang = 'LMH';
%% initialization
name = ['mats/' params.expt '.mat'];
[hs train correct incorrect] = setupWorld(params);
% either generate or load the hypothesis space
if size(dir(name),1)>0
load(name);
% else
% hs = createHypothesisSpace(hs);
% hs = cacheCardinalities(hs);
% hs = cacheTest(hs);
% save(name,'hs');
end
%% find all rules compatible with all strings
ll = zeros(length(hs.hs),length(train));
for i = 1:length(hs.hs)
for j = 1:length(train)
if applyRuleToString(hs.hs{i},train{j})
ll(i,j) = 1;
end
end
end
true_of_all = mean(ll,2)==1;
%% then find strings consistent with true_of_all
consistent_strings = zeros(size(hs.all_strings));
for i = 1:length(hs.all_strings)
if all(hs.true_of(true_of_all,i))
consistent_strings(i) = 1;
end
end
%% write test results
writeResultsE1