{
  "id": 14210,
  "title": "One Million Monkeys approach",
  "url": "/competitions/billion-word-imputation/writeups/one-million-monkeys-one-million-monkeys-approach",
  "author_name": "",
  "post_date": "2015-05-14T00:21:00.317Z",
  "votes": 5,
  "comment_count": 7,
  "views": 2413,
  "content": "<p>Here's a brief description of what I did. &nbsp;I'm simplifying quite a bit and omitting a number&nbsp;of details in order to focus on the big picture.</p>\n<p>First,&nbsp;an overview of the sequence of steps in processing a single line:</p>\n<p>1) Guess which position the missing word is at.</p>\n<p>2) Generate candidate word insertions for the hypothesized position.</p>\n<p>3) Guess what word (from the candidates) should be inserted at the missing position.</p>\n<p>4) Compute a confidence score, C1, for the insertion of the hypothesized word at the hypothesized position.</p>\n<p>5) If C1 is high enough, output a line with the hypothesized word inserted at the hypothesized position.</p>\n<p>6) Compute a confidence score, C2, for the hypothesized position.</p>\n<p>7) If C2 is high enough, output a line with a space inserted at the hypothesized position.</p>\n<p>8) Otherwise just output the input line with no changes.</p>\n<p>For the two major tasks (guessing the position and guessing the word), I used relatively unsophisticated&nbsp;n-gram models. &nbsp;In particular, I used a rather naive&nbsp;additive smoothing approach for estimating n-gram probabilities. &nbsp;For example, for&nbsp;bigrams:</p>\n<p>P(w2|w1) = (C(w1,w2) + d) / ( d * |V| + C(w1))</p>\n<p>(|V| is the size of the bigram vocabulary, C(w1, w2) and C(w1) are the raw bigram/unigram counts in the training corpus.) &nbsp;In other words, I&nbsp;add a count of d to every n-gram where d is a parameter tuned empirically on a held-out data set.</p>\n<p>I used n-grams of length up to 6. &nbsp;When I calculate the probability of a given n-gram, I used only values of&nbsp;n such that the n-gram count was &gt; 0. &nbsp;To combine the n-gram estimates for different values of n, I employed a logistic regression model.</p>\n<p>I also incorporated a part-of-speech model into the missing position calculation using the Stanford POS tagger. &nbsp;This was just an n-gram model of the sort described above with part-of-speech tags rather than words as the constituents.</p>\n<p>Guessing the missing word is done with the same sort of n-gram model as just described.</p>\n<p>For the imputation task, choosing whether to guess a word has some subtleties. &nbsp;Notice that if you insert the wrong word at the right position, you may not suffer any increased edit distance. &nbsp;For example:</p>\n<p>Input: the bit the man</p>\n<p>True sentence: the dog&nbsp;bit the&nbsp;man</p>\n<p>Guessed sentence: the cat bit the&nbsp;man</p>\n<p>Note that although we have guessed the wrong we do not suffer any edit distance penalty (as compared to not guessing a word). &nbsp;This leads us to some conclusions that impact the design of confidence scores:</p>\n<p>1) Guessing a word should be done more conservatively&nbsp;if you are not confident you are inserting at the right position.</p>\n<p>2) Guessing long words should be done more conservatively than guessing short words.</p>\n<p>I used a linear regression model to predict the edit distance gain (or loss) from an insertion based on certain features. &nbsp;These features include things like the gap between the n-gram language model score for the top candidate and the next candidate. &nbsp;Likewise the gap between the position&nbsp;model scores for the top position and the next best position.</p>\n<p>I trained a separate regression&nbsp;model for different word lengths of inserted words to account for the second remark&nbsp;above; i.e., that we want to guess more or less aggressively depending on the length of the inserted word.</p>\n<p>There's a similar regression model that gives us a confidence score for positions. &nbsp;This one is a logistic regression model because we are simply trying to predict a binary value (have we&nbsp;guessed the right position or not?).</p>\n<p>All n-gram models were built with lower-cased text. &nbsp;When outputting an inserted word, we used the most common capitalization for that word (e.g., usa-&gt;USA, john-&gt;John, and-&gt;and).</p>",
  "messages": [
    {
      "id": "78335",
      "postDate": "05/14/2015 00:21:00",
      "content": "<p>Here's a brief description of what I did. &nbsp;I'm simplifying quite a bit and omitting a number&nbsp;of details in order to focus on the big picture.</p>\n<p>First,&nbsp;an overview of the sequence of steps in processing a single line:</p>\n<p>1) Guess which position the missing word is at.</p>\n<p>2) Generate candidate word insertions for the hypothesized position.</p>\n<p>3) Guess what word (from the candidates) should be inserted at the missing position.</p>\n<p>4) Compute a confidence score, C1, for the insertion of the hypothesized word at the hypothesized position.</p>\n<p>5) If C1 is high enough, output a line with the hypothesized word inserted at the hypothesized position.</p>\n<p>6) Compute a confidence score, C2, for the hypothesized position.</p>\n<p>7) If C2 is high enough, output a line with a space inserted at the hypothesized position.</p>\n<p>8) Otherwise just output the input line with no changes.</p>\n<p>For the two major tasks (guessing the position and guessing the word), I used relatively unsophisticated&nbsp;n-gram models. &nbsp;In particular, I used a rather naive&nbsp;additive smoothing approach for estimating n-gram probabilities. &nbsp;For example, for&nbsp;bigrams:</p>\n<p>P(w2|w1) = (C(w1,w2) + d) / ( d * |V| + C(w1))</p>\n<p>(|V| is the size of the bigram vocabulary, C(w1, w2) and C(w1) are the raw bigram/unigram counts in the training corpus.) &nbsp;In other words, I&nbsp;add a count of d to every n-gram where d is a parameter tuned empirically on a held-out data set.</p>\n<p>I used n-grams of length up to 6. &nbsp;When I calculate the probability of a given n-gram, I used only values of&nbsp;n such that the n-gram count was &gt; 0. &nbsp;To combine the n-gram estimates for different values of n, I employed a logistic regression model.</p>\n<p>I also incorporated a part-of-speech model into the missing position calculation using the Stanford POS tagger. &nbsp;This was just an n-gram model of the sort described above with part-of-speech tags rather than words as the constituents.</p>\n<p>Guessing the missing word is done with the same sort of n-gram model as just described.</p>\n<p>For the imputation task, choosing whether to guess a word has some subtleties. &nbsp;Notice that if you insert the wrong word at the right position, you may not suffer any increased edit distance. &nbsp;For example:</p>\n<p>Input: the bit the man</p>\n<p>True sentence: the dog&nbsp;bit the&nbsp;man</p>\n<p>Guessed sentence: the cat bit the&nbsp;man</p>\n<p>Note that although we have guessed the wrong we do not suffer any edit distance penalty (as compared to not guessing a word). &nbsp;This leads us to some conclusions that impact the design of confidence scores:</p>\n<p>1) Guessing a word should be done more conservatively&nbsp;if you are not confident you are inserting at the right position.</p>\n<p>2) Guessing long words should be done more conservatively than guessing short words.</p>\n<p>I used a linear regression model to predict the edit distance gain (or loss) from an insertion based on certain features. &nbsp;These features include things like the gap between the n-gram language model score for the top candidate and the next candidate. &nbsp;Likewise the gap between the position&nbsp;model scores for the top position and the next best position.</p>\n<p>I trained a separate regression&nbsp;model for different word lengths of inserted words to account for the second remark&nbsp;above; i.e., that we want to guess more or less aggressively depending on the length of the inserted word.</p>\n<p>There's a similar regression model that gives us a confidence score for positions. &nbsp;This one is a logistic regression model because we are simply trying to predict a binary value (have we&nbsp;guessed the right position or not?).</p>\n<p>All n-gram models were built with lower-cased text. &nbsp;When outputting an inserted word, we used the most common capitalization for that word (e.g., usa-&gt;USA, john-&gt;John, and-&gt;and).</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "78397",
      "postDate": "05/14/2015 13:38:22",
      "content": "<p>Congratulations on the win!</p>\n<p>My main take-away is that your winning methodology didn't focus on creating the most comprehensive language model (and then applying it to the task) - but rather concentrated more effort on understanding how to win against the (rather linguistically obtuse) scoring system.</p>\n<p>So, while I guess there are some eyebrows being raised at your use of the &quot;Stanford POS tagger&quot; (unless you trained it on the training data alone), that probably didn't have as big an impact as the sophisticated insertion-choice heuristics you developed.&nbsp; </p>\n<p>Thanks for the write-up.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "78401",
      "postDate": "05/14/2015 15:00:09",
      "content": "<p style=\"padding-left: 30px\">&quot;My main take-away is that your winning methodology didn't focus on creating the most comprehensive language model (and then applying it to the task) - but rather concentrated more effort on understanding how to win against the (rather linguistically obtuse) scoring system.&quot;</p>\n<p>Yes, there's something to that. &nbsp;In particular, the confidence scoring mechanism is optimized specifically for this task, taking into account the way this competition is scored (edit distance).</p>\n<p>I did gloss over some of the details in my language model - so it's probably not quite as simple or naive as I made it sound - but nevertheless I tend to agree with you that the language model was probably not the key differentiating factor of my system.</p>\n<p>If this competition were to be done again, I'm not sure that I'd recommend using the edit distance metric. &nbsp;It leads to work being done to optimize for that metric (as I did) which arguably distracts from what competitors &quot;should&quot; be working on. &nbsp;I think just giving a score of 0 or 1 depending on whether you reproduce the full sentence exactly correctly would be better.</p>\n<p style=\"padding-left: 30px\">&quot;So, while I guess there are some eyebrows being raised at your use of the &quot;Stanford POS tagger&quot; (unless you trained it on the training data alone), that probably didn't have as big an impact as the sophisticated insertion-choice heuristics you developed.&quot;</p>\n<p>Not sure why this would raise eyebrows. &nbsp;Also, to clarify, this is not something that I trained. &nbsp;The Stanford POS tagger works &quot;out of the box&quot;; i.e., it does not need to be trained by the user.</p>\n<p>In any case, I think I agree that it probably didn't add that much, although I don't have my notes in front of me at the moment.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "78409",
      "postDate": "05/14/2015 16:38:15",
      "content": "<p>Some statistics that may be of interest.</p>\n<p>Position detection:</p>\n<p>Applying the model to every line, we guess the correct position 69.9% of the time. &nbsp;(This is assessed using a cross-validation set.) &nbsp;Compare to team mern who report 71% on this task; so my system is actually worse, although in the same ballpark.</p>\n<p>Using a confidence score with one particular threshold, we make a prediction 70.9% of the time and achieve 83.7% accuracy when making a prediction.</p>\n<p>Overall task:</p>\n<p>We guess a word 57.9% of the time. &nbsp;When we guess, we guess exactly correctly (i.e., edit distance is zero) 56.6% of the time. &nbsp;Putting those things together, over the whole cross-validation set we produce the exactly correct output sentence 32.8% of the time.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "78443",
      "postDate": "05/14/2015 21:56:41",
      "content": "<p>Ahhgg - we've finished?! &nbsp;So many interesting things to do, so little time...</p>\n<p>Well done Eric seems like a good solid engineering approach.</p>\n<p>Sorry Merl - the combination of better LMs and all your other bits should have pulled it off - my fault completly for not having time.</p>\n<p>The main page for the Stanford POS tagger at&nbsp;http://nlp.stanford.edu/software/tagger.shtml says that &quot;The basic download contains two trained tagger models for English&quot;. &nbsp; &nbsp;I don't think these can be allowed, the rules are clear that the training data is the only data to be used.</p>\n<p>Eric - so you didn't try any nonsense words?? &nbsp;The basic approach is clear, find the right slot and fill it. &nbsp; But there was nothing in the rules to say that you had to fill it with a word from English and indeed someone (sorry, don't remember who) made the suggestion that if you knew the slot but not the filler then use two blanks but not one. &nbsp; There's an obvious generalisation, search over all possible strings for the minimum edit distance between the words that can fill the slot and weight the edit distance by the posterior of the word filling the slot. &nbsp; For example, as many words contain the letter &quot;i&quot; then if that's true of the weighted list then it's better to replace the single &quot; &quot; representing the missing word with &quot; i &quot; so gaining one edit distance assuming the slot was correct and another assuming the letter &quot;i&quot; was present.</p>\n<p>Kaggle - can we continue to post results and get them evaluated? &nbsp; If not, will you release the code that does the evaluation? &nbsp; There were several obvious flaws in the setup, even after including the test data in the training was fixed. &nbsp; There's quite some scope for using this problem as part of taught course.</p>\n<p>If anyone wants our n-best lists to continue this work then just email me.</p>\n\n<p>Tony</p>\n<p>-- <br>Dr A J Robinson, Founder<br>We are hiring: www.speechmatics.com/careers<br>Speechmatics is a trading name of Cantab Research Limited<br>Phone direct: 01223 778240 office: 01223 794497<br>Company reg no GB 05697423, VAT reg no 925606030<br>51 Canterbury Street, Cambridge, CB4 3QG, UK</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "78550",
      "postDate": "05/15/2015 19:24:12",
      "content": "<p style=\"padding-left: 30px\">&quot;The main page for the Stanford POS tagger at http://nlp.stanford.edu/software/tagger.shtml says that &quot;The basic download contains two trained tagger models for English&quot;. I don't think these can be allowed, the rules are clear that the training data is the only data to be used.&quot;</p>\n<p>Oh, I see the concern now. &nbsp;This is presumably what mdda was getting at too. &nbsp;Hmm, the competition is over now, but for my own interest I reran my system without the POS tagger. &nbsp;On my cross-validation set I get 3.944 which I estimate would correspond to 3.908 on the real test set.</p>\n<p style=\"padding-left: 30px\">&quot;Eric - so you didn't try any nonsense words??&quot;</p>\n<p>No, that wasn't part of my final submission. &nbsp;The only thing I did, as already described, was insert a space for cases where I had confidence in the position but no good guess as to the word. &nbsp;Very early on I tried inserting &quot;e&quot; in such cases and didn't get good results, but that might have been before I had good position detection.</p>\n<p>Arguably it's kind of silly to play games like inserting nonsense words, and doesn't further&nbsp;the research goals of the competition, so this may be another argument for not using edit distance as the scoring metric for this task.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "78591",
      "postDate": "05/15/2015 23:19:59",
      "content": "<p>[quote=Tony Robinson;78443]...there was nothing in the rules to say that you had to fill it with a word from English ...an obvious generalization, search over all possible strings for the minimum edit distance between the words that can fill the slot and weight the edit distance by the posterior of the word filling the slot. &nbsp;&nbsp;[/quote]</p>\n<p>I tried&nbsp;that exact approach. &nbsp;Finding a <a href=\"http://www.sciencedirect.com/science/article/pii/S0304397597002405\">median string is an NP complete problem</a>, but I found&nbsp;a <a href=\"https://pypi.python.org/pypi/python-Levenshtein/0.12.0\">library</a>&nbsp;that calculated median strings in a reasonable amount of time. I took a list of probable words (based on completing 4-grams or&nbsp;3-grams), then calculated the weighted median string of those words.&nbsp;</p>\n<p>Using the&nbsp;median string instead of the&nbsp;most probable word gave an improvement of&nbsp;0.25 - 0.3 on the leaderboard. &nbsp;So there's a non-trivial gain to be had by optimizing&nbsp;for the edit-distance scoring&nbsp;metric. &nbsp;</p>\n<p>On the other hand,&nbsp;if you start with a weak language model (as I did) these gains don't&nbsp;help much :)</p>\n<p>[quote=Tony Robinson;78443] &nbsp;Well done Eric seems like a good solid engineering approach.&nbsp;[/quote]</p>\n<p>Ditto -- congratulations!.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "78620",
      "postDate": "05/16/2015 08:20:30",
      "content": "<p>Congratulations!</p>\n<p>Interesting to see a lot of similarities in our approaches...</p>\n<p>I just posted a more detailed report describing my system in the &quot;my approach&quot; thread, but picking a couple of points from there:</p>\n<p>- I used a somewhat similar strategy regarding word insertion, but having actually 4 possible actions: insert word / leave as is / insert space / insert filler word (&quot;ae&quot;), with a rule based decision (using tunable thresholds) depending on the length of the inserted word.</p>\n<p>- A link from the word2vec site points to http://www.statmt.org/lm-benchmark/1-billion-word-language-modeling-benchmark-r13output.tar.gz, which includes a version of the test set reference, which matches 99.8% with the competition's test set. I re-calculated the distance score (using a plain edit distance function) for my system at several points of the process using this matched set, and got a result within 0.01 of my &quot;official&quot; submissions.</p>\n<p>- I actually thought the edit distance was a nice twist. Another possible variation would be to allow competitors several entries for each sentence, with different weights.</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 78397,
      "author_name": "mdda123",
      "author_url": "",
      "post_date": "05/14/2015 13:38:22",
      "content": "<p>Congratulations on the win!</p>\n<p>My main take-away is that your winning methodology didn't focus on creating the most comprehensive language model (and then applying it to the task) - but rather concentrated more effort on understanding how to win against the (rather linguistically obtuse) scoring system.</p>\n<p>So, while I guess there are some eyebrows being raised at your use of the &quot;Stanford POS tagger&quot; (unless you trained it on the training data alone), that probably didn't have as big an impact as the sophisticated insertion-choice heuristics you developed.&nbsp; </p>\n<p>Thanks for the write-up.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 78401,
      "author_name": "onemillionmonkeys",
      "author_url": "",
      "post_date": "05/14/2015 15:00:09",
      "content": "<p style=\"padding-left: 30px\">&quot;My main take-away is that your winning methodology didn't focus on creating the most comprehensive language model (and then applying it to the task) - but rather concentrated more effort on understanding how to win against the (rather linguistically obtuse) scoring system.&quot;</p>\n<p>Yes, there's something to that. &nbsp;In particular, the confidence scoring mechanism is optimized specifically for this task, taking into account the way this competition is scored (edit distance).</p>\n<p>I did gloss over some of the details in my language model - so it's probably not quite as simple or naive as I made it sound - but nevertheless I tend to agree with you that the language model was probably not the key differentiating factor of my system.</p>\n<p>If this competition were to be done again, I'm not sure that I'd recommend using the edit distance metric. &nbsp;It leads to work being done to optimize for that metric (as I did) which arguably distracts from what competitors &quot;should&quot; be working on. &nbsp;I think just giving a score of 0 or 1 depending on whether you reproduce the full sentence exactly correctly would be better.</p>\n<p style=\"padding-left: 30px\">&quot;So, while I guess there are some eyebrows being raised at your use of the &quot;Stanford POS tagger&quot; (unless you trained it on the training data alone), that probably didn't have as big an impact as the sophisticated insertion-choice heuristics you developed.&quot;</p>\n<p>Not sure why this would raise eyebrows. &nbsp;Also, to clarify, this is not something that I trained. &nbsp;The Stanford POS tagger works &quot;out of the box&quot;; i.e., it does not need to be trained by the user.</p>\n<p>In any case, I think I agree that it probably didn't add that much, although I don't have my notes in front of me at the moment.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 78409,
      "author_name": "onemillionmonkeys",
      "author_url": "",
      "post_date": "05/14/2015 16:38:15",
      "content": "<p>Some statistics that may be of interest.</p>\n<p>Position detection:</p>\n<p>Applying the model to every line, we guess the correct position 69.9% of the time. &nbsp;(This is assessed using a cross-validation set.) &nbsp;Compare to team mern who report 71% on this task; so my system is actually worse, although in the same ballpark.</p>\n<p>Using a confidence score with one particular threshold, we make a prediction 70.9% of the time and achieve 83.7% accuracy when making a prediction.</p>\n<p>Overall task:</p>\n<p>We guess a word 57.9% of the time. &nbsp;When we guess, we guess exactly correctly (i.e., edit distance is zero) 56.6% of the time. &nbsp;Putting those things together, over the whole cross-validation set we produce the exactly correct output sentence 32.8% of the time.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 78443,
      "author_name": "tonyrobinson",
      "author_url": "",
      "post_date": "05/14/2015 21:56:41",
      "content": "<p>Ahhgg - we've finished?! &nbsp;So many interesting things to do, so little time...</p>\n<p>Well done Eric seems like a good solid engineering approach.</p>\n<p>Sorry Merl - the combination of better LMs and all your other bits should have pulled it off - my fault completly for not having time.</p>\n<p>The main page for the Stanford POS tagger at&nbsp;http://nlp.stanford.edu/software/tagger.shtml says that &quot;The basic download contains two trained tagger models for English&quot;. &nbsp; &nbsp;I don't think these can be allowed, the rules are clear that the training data is the only data to be used.</p>\n<p>Eric - so you didn't try any nonsense words?? &nbsp;The basic approach is clear, find the right slot and fill it. &nbsp; But there was nothing in the rules to say that you had to fill it with a word from English and indeed someone (sorry, don't remember who) made the suggestion that if you knew the slot but not the filler then use two blanks but not one. &nbsp; There's an obvious generalisation, search over all possible strings for the minimum edit distance between the words that can fill the slot and weight the edit distance by the posterior of the word filling the slot. &nbsp; For example, as many words contain the letter &quot;i&quot; then if that's true of the weighted list then it's better to replace the single &quot; &quot; representing the missing word with &quot; i &quot; so gaining one edit distance assuming the slot was correct and another assuming the letter &quot;i&quot; was present.</p>\n<p>Kaggle - can we continue to post results and get them evaluated? &nbsp; If not, will you release the code that does the evaluation? &nbsp; There were several obvious flaws in the setup, even after including the test data in the training was fixed. &nbsp; There's quite some scope for using this problem as part of taught course.</p>\n<p>If anyone wants our n-best lists to continue this work then just email me.</p>\n\n<p>Tony</p>\n<p>-- <br>Dr A J Robinson, Founder<br>We are hiring: www.speechmatics.com/careers<br>Speechmatics is a trading name of Cantab Research Limited<br>Phone direct: 01223 778240 office: 01223 794497<br>Company reg no GB 05697423, VAT reg no 925606030<br>51 Canterbury Street, Cambridge, CB4 3QG, UK</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 78550,
      "author_name": "onemillionmonkeys",
      "author_url": "",
      "post_date": "05/15/2015 19:24:12",
      "content": "<p style=\"padding-left: 30px\">&quot;The main page for the Stanford POS tagger at http://nlp.stanford.edu/software/tagger.shtml says that &quot;The basic download contains two trained tagger models for English&quot;. I don't think these can be allowed, the rules are clear that the training data is the only data to be used.&quot;</p>\n<p>Oh, I see the concern now. &nbsp;This is presumably what mdda was getting at too. &nbsp;Hmm, the competition is over now, but for my own interest I reran my system without the POS tagger. &nbsp;On my cross-validation set I get 3.944 which I estimate would correspond to 3.908 on the real test set.</p>\n<p style=\"padding-left: 30px\">&quot;Eric - so you didn't try any nonsense words??&quot;</p>\n<p>No, that wasn't part of my final submission. &nbsp;The only thing I did, as already described, was insert a space for cases where I had confidence in the position but no good guess as to the word. &nbsp;Very early on I tried inserting &quot;e&quot; in such cases and didn't get good results, but that might have been before I had good position detection.</p>\n<p>Arguably it's kind of silly to play games like inserting nonsense words, and doesn't further&nbsp;the research goals of the competition, so this may be another argument for not using edit distance as the scoring metric for this task.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 78591,
      "author_name": "chefele",
      "author_url": "",
      "post_date": "05/15/2015 23:19:59",
      "content": "<p>[quote=Tony Robinson;78443]...there was nothing in the rules to say that you had to fill it with a word from English ...an obvious generalization, search over all possible strings for the minimum edit distance between the words that can fill the slot and weight the edit distance by the posterior of the word filling the slot. &nbsp;&nbsp;[/quote]</p>\n<p>I tried&nbsp;that exact approach. &nbsp;Finding a <a href=\"http://www.sciencedirect.com/science/article/pii/S0304397597002405\">median string is an NP complete problem</a>, but I found&nbsp;a <a href=\"https://pypi.python.org/pypi/python-Levenshtein/0.12.0\">library</a>&nbsp;that calculated median strings in a reasonable amount of time. I took a list of probable words (based on completing 4-grams or&nbsp;3-grams), then calculated the weighted median string of those words.&nbsp;</p>\n<p>Using the&nbsp;median string instead of the&nbsp;most probable word gave an improvement of&nbsp;0.25 - 0.3 on the leaderboard. &nbsp;So there's a non-trivial gain to be had by optimizing&nbsp;for the edit-distance scoring&nbsp;metric. &nbsp;</p>\n<p>On the other hand,&nbsp;if you start with a weak language model (as I did) these gains don't&nbsp;help much :)</p>\n<p>[quote=Tony Robinson;78443] &nbsp;Well done Eric seems like a good solid engineering approach.&nbsp;[/quote]</p>\n<p>Ditto -- congratulations!.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 78620,
      "author_name": "meron1",
      "author_url": "",
      "post_date": "05/16/2015 08:20:30",
      "content": "<p>Congratulations!</p>\n<p>Interesting to see a lot of similarities in our approaches...</p>\n<p>I just posted a more detailed report describing my system in the &quot;my approach&quot; thread, but picking a couple of points from there:</p>\n<p>- I used a somewhat similar strategy regarding word insertion, but having actually 4 possible actions: insert word / leave as is / insert space / insert filler word (&quot;ae&quot;), with a rule based decision (using tunable thresholds) depending on the length of the inserted word.</p>\n<p>- A link from the word2vec site points to http://www.statmt.org/lm-benchmark/1-billion-word-language-modeling-benchmark-r13output.tar.gz, which includes a version of the test set reference, which matches 99.8% with the competition's test set. I re-calculated the distance score (using a plain edit distance function) for my system at several points of the process using this matched set, and got a result within 0.01 of my &quot;official&quot; submissions.</p>\n<p>- I actually thought the edit distance was a nice twist. Another possible variation would be to allow competitors several entries for each sentence, with different weights.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "78335": "",
    "78397": "",
    "78401": "",
    "78409": "",
    "78443": "",
    "78550": "",
    "78591": "",
    "78620": ""
  },
  "source": "existing_discussion",
  "complete": true,
  "competition_id": 3927,
  "competition_slug": "billion-word-imputation",
  "team_id": 112039,
  "solution_url": "/competitions/billion-word-imputation/writeups/one-million-monkeys-one-million-monkeys-approach"
}