{
  "id": 443742,
  "title": "What is this rolling mean in HSNotD ?",
  "url": "/competitions/child-mind-institute-detect-sleep-states/discussion/443742",
  "author_name": "",
  "post_date": "2023-09-28T14:51:15.349490Z",
  "votes": 4,
  "comment_count": 1,
  "views": 0,
  "content": "<p>I am seeing these rolling features giving the best score in many public notebooks.  : <br>\n<code>for mins in [5, 30, 60*2, 60*8] :\n    features += [\n        pl.col('enmo').rolling_mean(12 * mins, center=True, min_periods=1).abs().cast(pl.UInt16).alias(f'enmo_{mins}m_mean'),\n        pl.col('enmo').rolling_max(12 * mins, center=True, min_periods=1).abs().cast(pl.UInt16).alias(f'enmo_{mins}m_max')\n    ]</code></p>\n<p>The reading is taken every 5 minutes in the data. Now, we are taking the rolling features with a window of 12<em>5 = 60 to 12</em>60*8  = 5760 minutes. In the data description they say that a period of 30 minutes can also be classified as sleep. So, how does this feature make sense? </p>\n<p>Thanks for the help. </p>\n<p>Regards,<br>\nAbhrant</p>",
  "messages": [
    {
      "id": "2460056",
      "postDate": "09/28/2023 14:51:15",
      "content": "<p>I am seeing these rolling features giving the best score in many public notebooks.  : <br>\n<code>for mins in [5, 30, 60*2, 60*8] :\n    features += [\n        pl.col('enmo').rolling_mean(12 * mins, center=True, min_periods=1).abs().cast(pl.UInt16).alias(f'enmo_{mins}m_mean'),\n        pl.col('enmo').rolling_max(12 * mins, center=True, min_periods=1).abs().cast(pl.UInt16).alias(f'enmo_{mins}m_max')\n    ]</code></p>\n<p>The reading is taken every 5 minutes in the data. Now, we are taking the rolling features with a window of 12<em>5 = 60 to 12</em>60*8  = 5760 minutes. In the data description they say that a period of 30 minutes can also be classified as sleep. So, how does this feature make sense? </p>\n<p>Thanks for the help. </p>\n<p>Regards,<br>\nAbhrant</p>",
      "rawMarkdown": "I am seeing these rolling features giving the best score in many public notebooks.  : \n`for mins in [5, 30, 60*2, 60*8] :\n    features += [\n        pl.col('enmo').rolling_mean(12 * mins, center=True, min_periods=1).abs().cast(pl.UInt16).alias(f'enmo_{mins}m_mean'),\n        pl.col('enmo').rolling_max(12 * mins, center=True, min_periods=1).abs().cast(pl.UInt16).alias(f'enmo_{mins}m_max')\n    ]`\n\nThe reading is taken every 5 minutes in the data. Now, we are taking the rolling features with a window of 12*5 = 60 to 12*60*8  = 5760 minutes. In the data description they say that a period of 30 minutes can also be classified as sleep. So, how does this feature make sense? \n\nThanks for the help. \n\nRegards,\nAbhrant",
      "votes": null
    },
    {
      "id": "2460115",
      "postDate": "09/28/2023 15:24:38",
      "content": "<p>Sometime a larger rolling window can provide additional insights for the model. For instance, if the rolling mean is computed over an 8-hour window, the mean enmo values during the middle of the day are likely to be higher compared to those in the evening. This is because participants tend to be more active during the daytime. Consequently, such higher values can enable the model to decide that a high moving mean on 8 hour corresponds to a state of being awake. This is just a intuitive guess, but to be honest you don't actually know what the model is doing. What you can do is just fed loads and loads of feature into it, even it doesn't make sense, and just hope the score improves. </p>\n<p>By the way it is not </p>\n<blockquote>\n  <p>with a window of 125 = 60 to 1260*8 = 5760 minutes.</p>\n</blockquote>\n<p>since each row is different from the next row by 5 second, so for example 12 * 5 from above is just (12 * 5) rows * 5sec = 300 sec = 5 min.</p>",
      "rawMarkdown": "Sometime a larger rolling window can provide additional insights for the model. For instance, if the rolling mean is computed over an 8-hour window, the mean enmo values during the middle of the day are likely to be higher compared to those in the evening. This is because participants tend to be more active during the daytime. Consequently, such higher values can enable the model to decide that a high moving mean on 8 hour corresponds to a state of being awake. This is just a intuitive guess, but to be honest you don't actually know what the model is doing. What you can do is just fed loads and loads of feature into it, even it doesn't make sense, and just hope the score improves. \n\nBy the way it is not \n> with a window of 125 = 60 to 1260*8 = 5760 minutes.\n\nsince each row is different from the next row by 5 second, so for example 12 * 5 from above is just (12 * 5) rows * 5sec = 300 sec = 5 min.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2460115,
      "author_name": "yuchen2066",
      "author_url": "",
      "post_date": "09/28/2023 15:24:38",
      "content": "<p>Sometime a larger rolling window can provide additional insights for the model. For instance, if the rolling mean is computed over an 8-hour window, the mean enmo values during the middle of the day are likely to be higher compared to those in the evening. This is because participants tend to be more active during the daytime. Consequently, such higher values can enable the model to decide that a high moving mean on 8 hour corresponds to a state of being awake. This is just a intuitive guess, but to be honest you don't actually know what the model is doing. What you can do is just fed loads and loads of feature into it, even it doesn't make sense, and just hope the score improves. </p>\n<p>By the way it is not </p>\n<blockquote>\n  <p>with a window of 125 = 60 to 1260*8 = 5760 minutes.</p>\n</blockquote>\n<p>since each row is different from the next row by 5 second, so for example 12 * 5 from above is just (12 * 5) rows * 5sec = 300 sec = 5 min.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2460056": "I am seeing these rolling features giving the best score in many public notebooks.  : \n`for mins in [5, 30, 60*2, 60*8] :\n    features += [\n        pl.col('enmo').rolling_mean(12 * mins, center=True, min_periods=1).abs().cast(pl.UInt16).alias(f'enmo_{mins}m_mean'),\n        pl.col('enmo').rolling_max(12 * mins, center=True, min_periods=1).abs().cast(pl.UInt16).alias(f'enmo_{mins}m_max')\n    ]`\n\nThe reading is taken every 5 minutes in the data. Now, we are taking the rolling features with a window of 12*5 = 60 to 12*60*8  = 5760 minutes. In the data description they say that a period of 30 minutes can also be classified as sleep. So, how does this feature make sense? \n\nThanks for the help. \n\nRegards,\nAbhrant",
    "2460115": "Sometime a larger rolling window can provide additional insights for the model. For instance, if the rolling mean is computed over an 8-hour window, the mean enmo values during the middle of the day are likely to be higher compared to those in the evening. This is because participants tend to be more active during the daytime. Consequently, such higher values can enable the model to decide that a high moving mean on 8 hour corresponds to a state of being awake. This is just a intuitive guess, but to be honest you don't actually know what the model is doing. What you can do is just fed loads and loads of feature into it, even it doesn't make sense, and just hope the score improves. \n\nBy the way it is not \n> with a window of 125 = 60 to 1260*8 = 5760 minutes.\n\nsince each row is different from the next row by 5 second, so for example 12 * 5 from above is just (12 * 5) rows * 5sec = 300 sec = 5 min."
  },
  "source": "meta"
}