{
  "id": 206644,
  "title": "How to deal with `NaN` in neural networks?",
  "url": "/competitions/riiid-test-answer-prediction/discussion/206644",
  "author_name": "",
  "post_date": "2020-12-25T17:19:38.648397700Z",
  "votes": 2,
  "comment_count": 4,
  "views": 0,
  "content": "<p>I'm trying to train a Neural Network, the problem I came across are some features with <code>NaN</code> values, for example, the answer accuracy of the user. For these users who never answer a question before, the accuracy is <code>NaN</code>, how to deal with this kind of features? Filling them with 0 may not be the optimal choice.</p>",
  "messages": [
    {
      "id": "1126528",
      "postDate": "12/25/2020 17:19:38",
      "content": "<p>I'm trying to train a Neural Network, the problem I came across are some features with <code>NaN</code> values, for example, the answer accuracy of the user. For these users who never answer a question before, the accuracy is <code>NaN</code>, how to deal with this kind of features? Filling them with 0 may not be the optimal choice.</p>",
      "rawMarkdown": "I'm trying to train a Neural Network, the problem I came across are some features with `NaN` values, for example, the answer accuracy of the user. For these users who never answer a question before, the accuracy is `NaN`, how to deal with this kind of features? Filling them with 0 may not be the optimal choice.",
      "votes": null
    },
    {
      "id": "1126567",
      "postDate": "12/25/2020 17:42:26",
      "content": "<p>Take the average of all students' accuracy in the first 10 questions for example, and use it to fill those initial warmup period. That's what I did.</p>",
      "rawMarkdown": "Take the average of all students' accuracy in the first 10 questions for example, and use it to fill those initial warmup period. That's what I did.",
      "votes": null
    },
    {
      "id": "1126789",
      "postDate": "12/26/2020 00:29:49",
      "content": "<p>That's a reasonable solution, thanks for sharing.</p>",
      "rawMarkdown": "That's a reasonable solution, thanks for sharing.",
      "votes": null
    },
    {
      "id": "1128334",
      "postDate": "12/27/2020 10:53:11",
      "content": "<p>Fastai tabular learner generates new categorical features out of those with nans and fill nans with the mean value. </p>\n<p>If \"feat_x\" contains NaNs then generate \"feat_x_nan\" = \"feat_x\" is nan and fill \"feat_x\" NaNs with \"feat_x\" mean. </p>",
      "rawMarkdown": "Fastai tabular learner generates new categorical features out of those with nans and fill nans with the mean value. \n\nIf \"feat_x\" contains NaNs then generate \"feat_x_nan\" = \"feat_x\" is nan and fill \"feat_x\" NaNs with \"feat_x\" mean.",
      "votes": null
    },
    {
      "id": "1128956",
      "postDate": "12/27/2020 23:31:43",
      "content": "<p>Good idea, worth a try.</p>",
      "rawMarkdown": "Good idea, worth a try.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1126567,
      "author_name": "abdessalemboukil",
      "author_url": "",
      "post_date": "12/25/2020 17:42:26",
      "content": "<p>Take the average of all students' accuracy in the first 10 questions for example, and use it to fill those initial warmup period. That's what I did.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1126789,
          "author_name": "wuwenmin",
          "author_url": "",
          "post_date": "12/26/2020 00:29:49",
          "content": "<p>That's a reasonable solution, thanks for sharing.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1128334,
      "author_name": "cayala",
      "author_url": "",
      "post_date": "12/27/2020 10:53:11",
      "content": "<p>Fastai tabular learner generates new categorical features out of those with nans and fill nans with the mean value. </p>\n<p>If \"feat_x\" contains NaNs then generate \"feat_x_nan\" = \"feat_x\" is nan and fill \"feat_x\" NaNs with \"feat_x\" mean. </p>",
      "votes": null,
      "replies": [
        {
          "id": 1128956,
          "author_name": "wuwenmin",
          "author_url": "",
          "post_date": "12/27/2020 23:31:43",
          "content": "<p>Good idea, worth a try.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1126528": "I'm trying to train a Neural Network, the problem I came across are some features with `NaN` values, for example, the answer accuracy of the user. For these users who never answer a question before, the accuracy is `NaN`, how to deal with this kind of features? Filling them with 0 may not be the optimal choice.",
    "1126567": "Take the average of all students' accuracy in the first 10 questions for example, and use it to fill those initial warmup period. That's what I did.",
    "1126789": "That's a reasonable solution, thanks for sharing.",
    "1128334": "Fastai tabular learner generates new categorical features out of those with nans and fill nans with the mean value. \n\nIf \"feat_x\" contains NaNs then generate \"feat_x_nan\" = \"feat_x\" is nan and fill \"feat_x\" NaNs with \"feat_x\" mean.",
    "1128956": "Good idea, worth a try."
  },
  "source": "meta"
}