{
  "id": 22015,
  "title": "Error in get_label using xgboost",
  "url": "/competitions/facebook-v-predicting-check-ins/discussion/22015",
  "author_name": "",
  "post_date": "2016-07-02T22:09:47.870Z",
  "votes": null,
  "comment_count": 1,
  "views": 244,
  "content": "<p>Hi, I am new to xgboost, and here is my problem:</p>\n\n<p>When I assign large values to DMatrix and try get_label, it returns a result with some margin of error. Is there any way to avoid this? Probably store label as a int?\nThanks in advance.</p>\n\n<p><img src=\"http://c5.staticflickr.com/8/7501/27943063812_5ab6007a84.jpg\" alt=\"enter image description here\" title></p>",
  "messages": [
    {
      "id": "125807",
      "postDate": "07/02/2016 22:09:47",
      "content": "<p>Hi, I am new to xgboost, and here is my problem:</p>\n\n<p>When I assign large values to DMatrix and try get_label, it returns a result with some margin of error. Is there any way to avoid this? Probably store label as a int?\nThanks in advance.</p>\n\n<p><img src=\"http://c5.staticflickr.com/8/7501/27943063812_5ab6007a84.jpg\" alt=\"enter image description here\" title></p>",
      "rawMarkdown": "Hi, I am new to xgboost, and here is my problem:\r\n\r\nWhen I assign large values to DMatrix and try get_label, it returns a result with some margin of error. Is there any way to avoid this? Probably store label as a int?\r\nThanks in advance.\r\n\r\n![enter image description here][1]\r\n\r\n\r\n  [1]: http://c5.staticflickr.com/8/7501/27943063812_5ab6007a84.jpg",
      "votes": null
    },
    {
      "id": "125864",
      "postDate": "07/03/2016 18:40:00",
      "content": "<p>I ran into the same problem. I ended up using the scikit-learn LabelEncoder to encode labels and then decode them after the XGBoost step. </p>\n\n<pre><code># untested pseudo code\nimport sklearn.preprocessing\nle = sklearn.preprocessing.LabelEncoder()\nnew_y = le.fit_transform(y)\n# Use the DMatrix here\npredicted = le.inverse_transform(dmatrix_output).astype(int)\n</code></pre>",
      "rawMarkdown": "I ran into the same problem. I ended up using the scikit-learn LabelEncoder to encode labels and then decode them after the XGBoost step. \r\n\r\n    # untested pseudo code\r\n    import sklearn.preprocessing\r\n    le = sklearn.preprocessing.LabelEncoder()\r\n    new_y = le.fit_transform(y)\r\n    # Use the DMatrix here\r\n    predicted = le.inverse_transform(dmatrix_output).astype(int)",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 125864,
      "author_name": "rshekhar2",
      "author_url": "",
      "post_date": "07/03/2016 18:40:00",
      "content": "<p>I ran into the same problem. I ended up using the scikit-learn LabelEncoder to encode labels and then decode them after the XGBoost step. </p>\n\n<pre><code># untested pseudo code\nimport sklearn.preprocessing\nle = sklearn.preprocessing.LabelEncoder()\nnew_y = le.fit_transform(y)\n# Use the DMatrix here\npredicted = le.inverse_transform(dmatrix_output).astype(int)\n</code></pre>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "125807": "Hi, I am new to xgboost, and here is my problem:\r\n\r\nWhen I assign large values to DMatrix and try get_label, it returns a result with some margin of error. Is there any way to avoid this? Probably store label as a int?\r\nThanks in advance.\r\n\r\n![enter image description here][1]\r\n\r\n\r\n  [1]: http://c5.staticflickr.com/8/7501/27943063812_5ab6007a84.jpg",
    "125864": "I ran into the same problem. I ended up using the scikit-learn LabelEncoder to encode labels and then decode them after the XGBoost step. \r\n\r\n    # untested pseudo code\r\n    import sklearn.preprocessing\r\n    le = sklearn.preprocessing.LabelEncoder()\r\n    new_y = le.fit_transform(y)\r\n    # Use the DMatrix here\r\n    predicted = le.inverse_transform(dmatrix_output).astype(int)"
  },
  "source": "meta"
}