{
  "id": 1138,
  "title": "Here is a faster version of the lmer benchmark code in R",
  "url": "/competitions/WhatDoYouKnow/discussion/1138",
  "author_name": "",
  "post_date": "2011-12-08T23:38:47.823Z",
  "votes": 1,
  "comment_count": 3,
  "views": 3575,
  "content": "<p>The lmer benchmark code was a good start, but I decided to tweak it. The attached version is more general, modular, and about 7 times faster by my informal timing. It keeps the same general structure of iterating over one variable (track_name in the original\r\n example) which you can change, and lets you specify the other training variables in a more general way. It uses hash tables to speed access of the model results. The results are within a low-order bit of the original but not identical because I changed the\r\n logit function slightly to avoid exponentiation. Feel free to adapt and improve. It's semi, sort of, self documenting.</p>\r\n<p>--Steve</p>\r\n<p>[12/13/2011: This version has a bug. See my note below.]</p>",
  "messages": [
    {
      "id": "7025",
      "postDate": "12/08/2011 23:38:47",
      "content": "<p>The lmer benchmark code was a good start, but I decided to tweak it. The attached version is more general, modular, and about 7 times faster by my informal timing. It keeps the same general structure of iterating over one variable (track_name in the original\r\n example) which you can change, and lets you specify the other training variables in a more general way. It uses hash tables to speed access of the model results. The results are within a low-order bit of the original but not identical because I changed the\r\n logit function slightly to avoid exponentiation. Feel free to adapt and improve. It's semi, sort of, self documenting.</p>\r\n<p>--Steve</p>\r\n<p>[12/13/2011: This version has a bug. See my note below.]</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "7033",
      "postDate": "12/09/2011 12:37:14",
      "content": "<p>Steve,</p>\r\n<p>I noticed that you still use lmer. When I run the benchmark, what takes the longest time to run is is function.</p>\r\n<p>Would you mind explaining how your code runs lmer faster?</p>\r\n<p>Thanks,<br>\r\nRomano</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "7037",
      "postDate": "12/09/2011 17:33:39",
      "content": "<p>Romano, yes, you are right. My code calls the exact same function (lmer) from the lme4 library as the benchmark code. My version is a bit more general, in that you can easily change which variables go in the model. However, the training step using the lmer\r\n function in that library is still very, very slow. What I did was pull out the parts of the model structure needed for prediction, and do some tricks to make the prediction step run quickly. The net effect is that something very, very slow is now just very\r\n slow. I'd only recommend it if people want to run lme4.</p>\r\n<p>--Steve</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "7101",
      "postDate": "12/13/2011 17:29:22",
      "content": "<p>There is a bug in the code that I originally uploaded. The corrected version is attached. Many apologies if this has sent you astray. If there is some way to revoke my &quot;thanks&quot; point, now would be a good time to do so.</p>\r\n<p>&nbsp;</p>\r\n<p>&quot;We apologise again for the fault in the subtitles. Those responsible for sacking the people who have just been sacked have been sacked.&quot;</p>\r\n<p>--Steve</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 7033,
      "author_name": "romanos0",
      "author_url": "",
      "post_date": "12/09/2011 12:37:14",
      "content": "<p>Steve,</p>\r\n<p>I noticed that you still use lmer. When I run the benchmark, what takes the longest time to run is is function.</p>\r\n<p>Would you mind explaining how your code runs lmer faster?</p>\r\n<p>Thanks,<br>\r\nRomano</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 7037,
      "author_name": "sbagley",
      "author_url": "",
      "post_date": "12/09/2011 17:33:39",
      "content": "<p>Romano, yes, you are right. My code calls the exact same function (lmer) from the lme4 library as the benchmark code. My version is a bit more general, in that you can easily change which variables go in the model. However, the training step using the lmer\r\n function in that library is still very, very slow. What I did was pull out the parts of the model structure needed for prediction, and do some tricks to make the prediction step run quickly. The net effect is that something very, very slow is now just very\r\n slow. I'd only recommend it if people want to run lme4.</p>\r\n<p>--Steve</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 7101,
      "author_name": "sbagley",
      "author_url": "",
      "post_date": "12/13/2011 17:29:22",
      "content": "<p>There is a bug in the code that I originally uploaded. The corrected version is attached. Many apologies if this has sent you astray. If there is some way to revoke my &quot;thanks&quot; point, now would be a good time to do so.</p>\r\n<p>&nbsp;</p>\r\n<p>&quot;We apologise again for the fault in the subtitles. Those responsible for sacking the people who have just been sacked have been sacked.&quot;</p>\r\n<p>--Steve</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "7025": "",
    "7033": "",
    "7037": "",
    "7101": ""
  },
  "source": "meta"
}