Learning RSA

Toward an account of the Illusory Inference?

November 2017 — Mathias Sablé Meyer

## Error in library(foreach): there is no package called 'foreach'
## Error in library(doMC): there is no package called 'doMC'
## Error in registerDoMC(4): could not find function "registerDoMC"

Grab the source of this file here

Many thanks to Benjamin Spector

His seminar on RSA introduced me to this and he provided real-time feedback on my attempts to implement it.

A wee bit of theory

To do. Or better, refer to someone more competent (see previous title).

Let:

We define by recursion over \(n \in \mathbb{N}\) following triplet \(S, L, U\)Speaker, Listener, Utility

 where \(L_0\) is the naïve listener.

\[ \begin{eqnarray} L_0&(w&\mid& u) &\propto& P(w)Lex(u,w) \\ U_{n+1}&(u&\mid& w) &=& \log(L_n(w\mid u)) - c(u) \\ S_{n+1}&(u&\mid& w) &\propto& e^{\lambda U_{n+1}(u\mid w)} \\ L_{n+1}&(w&\mid& u) &\propto& P(w)S_{n+1}(u\mid w) \end{eqnarray} \]

(An) Implementation of the RSA

Remarks about the code:

Apart from that, thanks to R syntactic sugar, the implementation follows very closely the definitions.

Things we could to improve this if need be:

Here be the code:

A learning case

The parameters

I will only show how to call the function once. Then I’ll hide this.

somealljustSome
∃¬∀0.8101
0.1910

Key points:

  • Worlds: \(\{∃¬∀, ∀\}\)
  • Lexicon: \(\{some, all, justSome\}\)
  • \(\lambda = 1\)
  • Flat priors
  • Costs:
LexsomealljustSome
cost001
  • Truth table:
∃¬∀
some11
all01
justSome10

L\({}_{10}\)

somealljustSome
∃¬∀0.8101
0.1910

S\({}_{10}\)

somealljustSome
∃¬∀0.690.000.31
0.160.840.00

Four worlds, many messages

The parameters

Key points:

  • Worlds: \(\{∅, A¬B, B¬A, A∨B\}\)
  • Lexicon: \(\{A, B, AorB, AnotB, BnotA, notA, notB, neither\}\)
  • \(\lambda = 5\)
  • Flat priors
  • Costs:
LexABAorBAnotBBnotAnotAnotBneither
cost00111111
  • Truth table:
A¬BB¬AA∨B
A0101
B0011
AorB0001
AnotB0100
BnotA0010
notA1010
notB1100
neither1000

L\({}_{10}\)

somealljustSome
∃¬∀0.8101
0.1910

S\({}_{10}\)

somealljustSome
∃¬∀0.690.000.31
0.160.840.00

Non fully informed – with a “?”

The parameters

Key points:

  • Worlds: \(\{?, ∃¬∀, ∀\}\)
  • Lexicon: \(\{some, all, someNotAll\}\)
  • \(\lambda = 2\)
  • Flat priors
  • Costs:
LexsomeallsomeNotAll
cost002
  • Truth table:
?∃¬∀
some111
all001
someNotAll010

L\({}_{10}\)

somealljustSome
∃¬∀0.8101
0.1910

S\({}_{10}\)

somealljustSome
∃¬∀0.690.000.31
0.160.840.00

Four wor(l)ds

The parameters

Key points:

  • Worlds: \(\{∅, ∃¬∀, ∀\}\)
  • Lexicon: \(\{no, some, all, notAll\}\)
  • \(\lambda = 4\)
  • Flat priors
  • Costs:
LexnosomeallnotAll
cost0001
  • Truth table:
∃¬∀
no100
some011
all001
notAll110

L\({}_{1}\)

somealljustSome
∃¬∀0.8101
0.1910

S\({}_{1}\)

somealljustSome
∃¬∀0.690.000.31
0.160.840.00

All possibilities

The parameters

Key points:

  • Worlds: \(\{∅, ∃, ∃¬∀, ∀, ¬∀, ∅∨∀\}\)
  • Lexicon: \(\{no, some, someNotAll, all, notAll, NoneOrAll\}\)
  • \(\lambda = 2\)
  • Flat priors
  • Costs:
LexnosomesomeNotAllallnotAllNoneOrAll
cost224234
  • Truth table:
∃¬∀¬∀∅∨∀
no100000
some011100
someNotAll001000
all000100
notAll101010
noneOrAll100101

L\({}_{10}\)

somealljustSome
∃¬∀0.8101
0.1910

S\({}_{10}\)

somealljustSome
∃¬∀0.690.000.31
0.160.840.00

IIFD – no question

The parameters

Key points:

  • Worlds: \(\{C, BC, AC, ABC, AB\}\)
  • Lexicon: \(\{a, b, c, ab, ac, bc, abc\}\)
  • \(\lambda = 1\)
  • Flat priors
  • Costs:
Lexabcabacbcabc
cost0001112
  • Truth table:
CBCACABCAB
a00111
b01011
c11110
ab00011
ac00110
bc01010
abc00010

L\({}_{10}\)

somealljustSome
∃¬∀0.8101
0.1910

S\({}_{10}\)

somealljustSome
∃¬∀0.690.000.31
0.160.840.00

IIFD – artificial eroteticity

The parameters

Key points:

  • Worlds: \(\{AB?, C?\}\)
  • Lexicon: \(\{a, b, c, ab, aorc, borc\}\)
  • \(\lambda = 1\)
  • Flat priors
  • Costs:
Lexabcabaorcborc
cost000111
  • Truth table:
AB?C?
a10
b10
c01
ab10
aorc11
borc11

L\({}_{30}\)

somealljustSome
∃¬∀0.8101
0.1910

S\({}_{30}\)

somealljustSome
∃¬∀0.690.000.31
0.160.840.00

Cost plot

L(AB?|{a,b}) vs L(AB?|{ab}) as a function of cost
L(AB?|{a,b}) vs L(AB?|{ab}) as a function of cost

Heat map – square one

Key points:

∃¬∀
some11
all01
justSome10

Generate data:

Heat map of (lambda, cost) -> L(∃¬∀|‘some’)
Heat map of (lambda, cost) -> L(∃¬∀|‘some’)

Heat map – priors

Key points:

∃¬∀
no100
some011
all001
justSome010

Order of magnitude for what is computed:

Heat map of (lambda, prior) -> L(∃¬∀|‘some’)
Heat map of (lambda, prior) -> L(∃¬∀|‘some’)

Can we play with numbers?

Key points:

Lex123456789101112131415
cost00.0690.110.140.160.180.190.210.220.230.240.250.260.260.27
123456789101112131415
X1100000000000000
X2110000000000000
X3111000000000000
X4111100000000000
X5111110000000000
X6111111000000000
X7111111100000000
X8111111110000000
X9111111111000000
X10111111111100000
X11111111111110000
X12111111111111000
X13111111111111100
X14111111111111110
X15111111111111111

L\({}_{10}\)

somealljustSome
∃¬∀0.8101
0.1910

S\({}_{10}\)

somealljustSome
∃¬∀0.690.000.31
0.160.840.00

Moving on to Question Under Discussion (QUD)

To do:

Here’s an attempt:

Tools

Here are some functions/options used up there: