forked from langcog/ibr_pragmods
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.R
125 lines (105 loc) · 3.19 KB
/
tests.R
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/usr/bin/env R
source('ibr.R')
source('viz_img.R')
######################################################################
## SCENARIOS:
## A standard scalar implicature case:
scalars = matrix(
c(1, 0, 0,
0, 1, 0,
0, 1, 1), byrow=T, nrow=3,
dimname=list(
c('w_no', 'w_somenotall', 'w_all'), # Row names; worlds.
c('NO', 'SOME', 'ALL'))) # Column names; messages.
## Stiller scales
stiller.scales = matrix(
c(0, 0,
0, 1,
1, 1), byrow=T, nrow=3,
dimname=list(
c('r1', 'r2', 'r3'), # Row names; referents.
c('hat', 'glasses'))) # Column names; messages.
## dominance
dominance = matrix(
c(0, 0, 1,
0, 1, 1,
1, 1, 1), byrow=T, nrow=3,
dimname=list(
c('r1', 'r2', 'r3'), # Row names; referents.
c('hat', 'glasses','mustache'))) # Column names; messages.
## linear
linear = matrix(
c(0, 0, 1,
0, 1, 1,
1, 1, 0), byrow=T, nrow=3,
dimname=list(
c('r1', 'r2', 'r3'), # Row names; referents.
c('hat', 'glasses','mustache'))) # Column names; messages.
## Stiller no-scales
stiller.noscales = matrix(
c(0, 0, 1, 1,
0, 1, 1, 0,
1, 1, 0, 0), byrow=T, nrow=3,
dimname=list(
c('r1', 'r2', 'r3'), # Row names; referents.
c('hat', 'glasses', 'mustache','tie'))) # Column names; messages.
## Stiller no-scales, but with the ballcap left null:
stiller.noscales.mod = matrix(
c(0, 0, 1,
0, 1, 1,
1, 1, 0), byrow=T, nrow=3,
dimname=list(
c('r1', 'r2', 'r3'), # Row names; referents.
c('hat', 'glasses', 'mustache'))) # Column names; messages.
## Science paper referential game:
fg = matrix(
c(1,0,1,0,
1,0,0,1,
0,1,1,0), byrow=T, nrow=3,
dimnames=list(
c('r_bs','r_bc','r_gs'), # Row names; objects.
c('blue','green','square','circle')) # Colum names; messages.
)
## Mason Chua's iteration depth
mason = matrix(
c(1, 1, 1,
1, 1, 0,
1, 0, 1), byrow=T, nrow=3,
dimname=list(
c('r1', 'r2', 'r3'), # Row names; referents.
c('hat', 'glasses', 'mustache'))) # Column names; messages.
# note: try this - IBR(mason,prior=c(.5,.3,.1))
# could be interesting and useful for testing argmax claims because this
# setting totally destroys us
## The Horn division of labor game (makes crucial use of the costs)
hornnames = list(
c('w_footbreak', 'w_ditch'),
c('STOP', 'MAKE-STOP'))
## Utilities:
hornutil = matrix(
c(1,1,
1,1), byrow=T, nrow=2,
dimnames=hornnames)
## Costs:
horncosts = list()
horncosts[[1]] = t(matrix(c(0, 0, 1/10, 1/10), byrow=T, nrow=2, dimnames=hornnames))
horncosts[[2]] = matrix(c(0, 1/10, 0, 1/10), byrow=T, nrow=2, dimnames=hornnames)
## A 4x4 case that requires 7 matrices in IBR:
m7 = matrix(
c(0,0,1,1,
1,1,0,0,
0,1,0,1,
1,0,0,1), byrow=T, nrow=4,
dimnames=list(paste("t", seq(1,4),sep=''), ## Row names; refernets.
c('hat', 'glasses', 'must', 'hair'))) ## Column names; messages.
stiller.scales = matrix(
c(0, 0,
0, 1,
1, 1), byrow=T, nrow=3,
dimname=list(
c('r1', 'r2', 'r3'), # Row names; referents.
c('hat', 'glasses'))) # Column names; messages.
#demos for vogel paper
quartz()
ImageViz(stiller.scales[c(3,2,1),])
ImageViz(linear[c(3,1,2),])