1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml"
4 lang="en" xml:lang="en">
7 <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
8 <meta name="generator" content="Org-mode"/>
9 <meta name="generated" content="2008/05/28 13:40:17"/>
10 <meta name="author" content="Kevin Brubeck Unhammer"/>
11 <link rel="stylesheet" type="text/css" href="http://www.student.uib.no/~kun041/org.css">
13 <h1 class="title">DMV/CCM</h1>
14 <div id="table-of-contents">
15 <h2>Table of Contents</h2>
16 <div id="text-table-of-contents">
18 <li><a href="#sec-1">1 dmvccm</a>
20 <li><a href="#sec-1.1">1.1 [#A] P<sub>STOP</sub></a>
22 <li><a href="#sec-1.1.1">1.1.1 Remember: The P<sub>STOP</sub> formula is upside-down (left-to-right also)</a></li>
23 <li><a href="#sec-1.1.2">1.1.2 How is the P<sub>STOP</sub> formula different given other values for dir and adj?</a></li>
26 <li><a href="#sec-1.2">1.2 P<sub>CHOOSE</sub></a></li>
27 <li><a href="#sec-1.3">1.3 Some (tagged) sentences are bound to come twice</a></li>
28 <li><a href="#sec-1.4">1.4 Initialization </a>
30 <li><a href="#sec-1.4.1">1.4.1 DMV Initialization frequencies </a></li>
31 <li><a href="#sec-1.4.2">1.4.2 DMV Initialization probabilities (from initialization frequency)</a></li>
32 <li><a href="#sec-1.4.3">1.4.3 CCM Initialization </a></li>
35 <li><a href="#sec-1.5">1.5 Adjacency and combining it with inner()</a></li>
36 <li><a href="#sec-1.6">1.6 Is the E-step in DMV just inner() on the full sentence? </a></li>
37 <li><a href="#sec-1.7">1.7 [#C] Corpus access</a></li>
38 <li><a href="#sec-1.8">1.8 How do we interpret DMV as an inside/outside process? </a></li>
39 <li><a href="#sec-1.9">1.9 Technical: sentences or rules as the "outer loop"?</a></li>
40 <li><a href="#sec-1.10">1.10 CCM-stuff</a></li>
41 <li><a href="#sec-1.11">1.11 How do we know whether we are 'adjacent' or not? </a></li>
44 <li><a href="#sec-2">2 Python-stuff</a></li>
49 <div id="outline-container-1" class="outline-2">
50 <h2 id="sec-1">1 dmvccm</h2>
53 <p><span class="timestamp-kwd">DEADLINE: </span> <span class="timestamp">2008-06-30 Mon</span><br/>
54 (But absolute, extended, really-quite-dead-now deadline: August 31…)
55 <a href="src/dmv.py">dmv.py</a>
56 <a href="src/io.py">io.py</a>
60 <div id="outline-container-1.1" class="outline-3">
61 <h3 id="sec-1.1">1.1 <span class="todo">TODO</span> [#A] P<sub>STOP</sub></h3>
64 <p><a href="src/dmv.py">dmv-P_STOP</a>
68 <div id="outline-container-1.1.1" class="outline-4">
69 <h4 id="sec-1.1.1">1.1.1 Remember: The P<sub>STOP</sub> formula is upside-down (left-to-right also)</h4>
76 <div id="outline-container-1.1.2" class="outline-4">
77 <h4 id="sec-1.1.2">1.1.2 How is the P<sub>STOP</sub> formula different given other values for dir and adj?</h4>
80 <p>(Presumably, the P<sub>STOP</sub> formula where STOP is True is just the
81 rule-probability of <u>h</u> -> STOP h_ or h_ -> h STOP, but how does
82 adjacency fit in here?)
85 (And P<sub>STOP</sub>(-STOP|…) = 1 - P<sub>STOP</sub>(STOP|…) )
91 <div id="outline-container-1.2" class="outline-3">
92 <h3 id="sec-1.2">1.2 <span class="todo">TODO</span> P<sub>CHOOSE</sub></h3>
95 <p>Write the formulas! should be easy?
100 <div id="outline-container-1.3" class="outline-3">
101 <h3 id="sec-1.3">1.3 <span class="todo">TOGROK</span> Some (tagged) sentences are bound to come twice <span class="tag">OPTIMIZE</span></h3>
104 <p>Eg, first sort and count, so that the corpus
105 [['nn','vbd','det','nn'],
106 ['vbd','nn','det','nn'],
107 ['nn','vbd','det','nn']]
109 [(['nn','vbd','det','nn'],2),
110 (['vbd','nn','det','nn'],1)]
111 and then in each loop through sentences, make sure we handle the
115 Is there much to gain here?
120 <div id="outline-container-1.4" class="outline-3">
121 <h3 id="sec-1.4">1.4 Initialization </h3>
124 <p><a href="/Users/kiwibird/Documents/Skole/V08/Probability/dmvccm/src/dmv.py">dmv-inits</a>
127 We do have to go through the corpus, since the probabilities are based
128 on how far away in the sentence arguments are from their heads.
132 <div id="outline-container-1.4.1" class="outline-4">
133 <h4 id="sec-1.4.1">1.4.1 <span class="done">DONE</span> DMV Initialization frequencies </h4>
134 <div id="text-1.4.1">
136 <p><span class="timestamp-kwd">CLOSED: </span> <span class="timestamp">2008-05-27 Tue 20:04</span><br/>
140 <div id="outline-container-1.4.1.1" class="outline-5">
141 <h5 id="sec-1.4.1.1">1.4.1.1 P<sub>STOP</sub> </h5>
142 <div id="text-1.4.1.1">
144 <p>P<sub>STOP</sub> is not well defined by K&M. One possible interpretation given
145 the sentence [det nn vb nn] is
148 f<sub>STOP</sub>( STOP|det, L, adj) +1
151 f<sub>STOP</sub>(-STOP|det, L, adj) +0
154 f<sub>STOP</sub>( STOP|det, L, non<sub>adj</sub>) +1
157 f<sub>STOP</sub>(-STOP|det, L, non<sub>adj</sub>) +0
160 f<sub>STOP</sub>( STOP|det, R, adj) +0
163 f<sub>STOP</sub>(-STOP|det, R, adj) +1
167 f<sub>STOP</sub>( STOP|nn, L, adj) +0
170 f<sub>STOP</sub>(-STOP|nn, L, adj) +1
173 f<sub>STOP</sub>( STOP|nn, L, non<sub>adj</sub>) +1 # since there's at least one to the left
176 f<sub>STOP</sub>(-STOP|nn, L, non<sub>adj</sub>) +0
183 <div id="outline-container-1.4.1.2" class="outline-5">
184 <h5 id="sec-1.4.1.2">1.4.1.2 P<sub>CHOOSE</sub></h5>
185 <div id="text-1.4.1.2">
187 <p>Go through the corpus, counting distances between heads and
188 arguments. In [det nn vb nn], we give
191 f<sub>CHOOSE</sub>(nn|det, R) +1/1 + C
194 f<sub>CHOOSE</sub>(vb|det, R) +1/2 + C
197 f<sub>CHOOSE</sub>(nn|det, R) +1/3 + C
200 If this were the full corpus, P<sub>CHOOSE</sub>(nn|det, R) would have
201 (1+1/3+2C) / sum<sub>a</sub> f<sub>CHOOSE</sub>(a|det, R)
206 <p>The ROOT gets "each argument with equal probability", so in a sentence
207 of three words, 1/3 for each (in [nn vb nn], 'nn' gets 2/3). Basically
208 just a frequency count of the corpus…
214 <div id="outline-container-1.4.2" class="outline-4">
215 <h4 id="sec-1.4.2">1.4.2 <span class="todo">TOGROK</span> DMV Initialization probabilities (from initialization frequency)</h4>
216 <div id="text-1.4.2">
222 <div id="outline-container-1.4.3" class="outline-4">
223 <h4 id="sec-1.4.3">1.4.3 <span class="todo">TOGROK</span> CCM Initialization </h4>
224 <div id="text-1.4.3">
226 <p>P<sub>SPLIT</sub> used here… how, again?
235 <div id="outline-container-1.5" class="outline-3">
236 <h3 id="sec-1.5">1.5 <span class="todo">TOGROK</span> Adjacency and combining it with inner()</h3>
243 <div id="outline-container-1.6" class="outline-3">
244 <h3 id="sec-1.6">1.6 <span class="todo">TOGROK</span> Is the E-step in DMV just inner() on the full sentence? </h3>
247 <p>and What exactly is the M-step of DMV?
253 <div id="outline-container-1.7" class="outline-3">
254 <h3 id="sec-1.7">1.7 <span class="todo">TODO</span> [#C] Corpus access</h3>
261 <div id="outline-container-1.8" class="outline-3">
262 <h3 id="sec-1.8">1.8 <span class="todo">TOGROK</span> How do we interpret DMV as an inside/outside process? </h3>
265 <p>c<sub>s</sub>(x : i, j) is "the expected fraction of parses of s" with x from
266 i to j; expectation then uses the probabilities gotten from
267 initialization and previously gained probabilities, but these are of
268 the form P<sub>STOP</sub> and P<sub>CHOOSE</sub>, how do we translate this to inside
269 outside, which just uses the probabilities of CFG-rules?
275 <div id="outline-container-1.9" class="outline-3">
276 <h3 id="sec-1.9">1.9 Technical: sentences or rules as the "outer loop"?</h3>
283 <div id="outline-container-1.10" class="outline-3">
284 <h3 id="sec-1.10">1.10 CCM-stuff</h3>
291 <div id="outline-container-1.11" class="outline-3">
292 <h3 id="sec-1.11">1.11 <span class="done">DONE</span> How do we know whether we are 'adjacent' or not? </h3>
298 <div id="outline-container-1.11.0.1" class="outline-5">
299 <h5 id="sec-1.11.0.1">1.11.0.1 One configuration that I'm fairly certain of: right w/CHOOSE</h5>
300 <div id="text-1.11.0.1">
303 \Tree [<sub>b</sub> [<sub>b</sub> b <u>c</u> ] <u>d</u> ]
304 then the lower tree [<sub>b</sub> b <u>c</u> ] is adjacent since, working your way up
305 the tree, no argument has been created to the right "yet"; while the
306 outer tree [<sub>b</sub> [<sub>b</sub> … ] <u>d</u> ] is non-adjacent, since there is something in
307 between… Is it thus always adjacent to the right if the distance
308 is 2? (That is, in e(s,t,i) for the adjacent rule: t - s == 2; while
309 in the non_adj rule: t - s == 4)
311 <li id="sec-1.11.0.1.1">Implementing this:<br/>
312 Two different DMVRules? Or just two different prob-values per rule?
319 <div id="outline-container-1.11.0.2" class="outline-5">
320 <h5 id="sec-1.11.0.2">1.11.0.2 left w/CHOOSE</h5>
321 <div id="text-1.11.0.2">
328 <div id="outline-container-1.11.0.3" class="outline-5">
329 <h5 id="sec-1.11.0.3">1.11.0.3 R/L without CHOOSE, the "sealing operations"</h5>
330 <div id="text-1.11.0.3">
332 <p><u>h</u> -> STOP h_ and h_ -> h STOP
335 What is "adjacency" here? That t - s == 1?
346 <div id="outline-container-2" class="outline-2">
347 <h2 id="sec-2">2 Python-stuff</h2>
352 <a href="src/pseudo.py">pseudo.py</a>
355 <a href="http://nltk.org/doc/en/structured-programming.html">http://nltk.org/doc/en/structured-programming.html</a> recursive dynamic
358 <a href="http://nltk.org/doc/en/advanced-parsing.html">http://nltk.org/doc/en/advanced-parsing.html</a>
365 <div id="postamble"><p class="author"> Author: Kevin Brubeck Unhammer
366 <a href="mailto:K.BrubeckUnhammer at student uva nl "><K.BrubeckUnhammer at student uva nl ></a>
368 <p class="date"> Date: 2008/05/28 13:40:17</p>
369 </div><p class="postamble">Skrive vha. emacs + <a href='http://orgmode.org/'>org-mode</a></p></body>