{
  "id": 398500,
  "title": "Have a problem about save_model .xgb file",
  "url": "/competitions/predict-student-performance-from-game-play/discussion/398500",
  "author_name": "",
  "post_date": "2023-03-30T10:49:53.624947100Z",
  "votes": 2,
  "comment_count": 4,
  "views": 0,
  "content": "<p>I split the notebook into 2 parts: train and inference, but when I save the model.xgb files. I can't load the model in the inference part. Can anyone help me solve this?</p>",
  "messages": [
    {
      "id": "2202821",
      "postDate": "03/30/2023 10:49:53",
      "content": "<p>I split the notebook into 2 parts: train and inference, but when I save the model.xgb files. I can't load the model in the inference part. Can anyone help me solve this?</p>",
      "rawMarkdown": "I split the notebook into 2 parts: train and inference, but when I save the model.xgb files. I can't load the model in the inference part. Can anyone help me solve this?",
      "votes": null
    },
    {
      "id": "2202834",
      "postDate": "03/30/2023 10:59:04",
      "content": "<p>Hi, do you save your model with <code>xgb_model.save_model('model_name.json')</code>?</p>",
      "rawMarkdown": "Hi, do you save your model with `xgb_model.save_model('model_name.json')`?",
      "votes": null
    },
    {
      "id": "2202900",
      "postDate": "03/30/2023 11:45:11",
      "content": "<p>Oh, thank i saw everyone use <code>xgb_model.save_model('model_name.xgb')</code></p>",
      "rawMarkdown": "Oh, thank i saw everyone use `xgb_model.save_model('model_name.xgb')`",
      "votes": null
    },
    {
      "id": "2202930",
      "postDate": "03/30/2023 12:05:04",
      "content": "<pre><code>clf = XGBClassifier()\nclf.load_model()\n</code></pre>",
      "rawMarkdown": "```python\nclf = XGBClassifier()\nclf.load_model('model_name.xgb')\n```",
      "votes": null
    },
    {
      "id": "2202978",
      "postDate": "03/30/2023 12:41:27",
      "content": "<p>This (<code>xgb_model.save_model('model_name.xgb')</code>) should also work. Just create an instance of the classifier (via <code>xgb_model = XGBClassifier()</code>) and load the model with <code>xgb_model.load_model('model_name.xgb')</code> as noted in the comment from <a href=\"https://www.kaggle.com/ihebch\" target=\"_blank\">@ihebch</a>.</p>",
      "rawMarkdown": "This (`xgb_model.save_model('model_name.xgb')`) should also work. Just create an instance of the classifier (via `xgb_model = XGBClassifier()`) and load the model with `xgb_model.load_model('model_name.xgb')` as noted in the comment from @ihebch.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2202834,
      "author_name": "heiligerl",
      "author_url": "",
      "post_date": "03/30/2023 10:59:04",
      "content": "<p>Hi, do you save your model with <code>xgb_model.save_model('model_name.json')</code>?</p>",
      "votes": null,
      "replies": [
        {
          "id": 2202900,
          "author_name": "thitiwat",
          "author_url": "",
          "post_date": "03/30/2023 11:45:11",
          "content": "<p>Oh, thank i saw everyone use <code>xgb_model.save_model('model_name.xgb')</code></p>",
          "votes": null,
          "replies": [
            {
              "id": 2202978,
              "author_name": "heiligerl",
              "author_url": "",
              "post_date": "03/30/2023 12:41:27",
              "content": "<p>This (<code>xgb_model.save_model('model_name.xgb')</code>) should also work. Just create an instance of the classifier (via <code>xgb_model = XGBClassifier()</code>) and load the model with <code>xgb_model.load_model('model_name.xgb')</code> as noted in the comment from <a href=\"https://www.kaggle.com/ihebch\" target=\"_blank\">@ihebch</a>.</p>",
              "votes": null,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2202930,
      "author_name": "ihebch",
      "author_url": "",
      "post_date": "03/30/2023 12:05:04",
      "content": "<pre><code>clf = XGBClassifier()\nclf.load_model()\n</code></pre>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2202821": "I split the notebook into 2 parts: train and inference, but when I save the model.xgb files. I can't load the model in the inference part. Can anyone help me solve this?",
    "2202834": "Hi, do you save your model with `xgb_model.save_model('model_name.json')`?",
    "2202900": "Oh, thank i saw everyone use `xgb_model.save_model('model_name.xgb')`",
    "2202930": "```python\nclf = XGBClassifier()\nclf.load_model('model_name.xgb')\n```",
    "2202978": "This (`xgb_model.save_model('model_name.xgb')`) should also work. Just create an instance of the classifier (via `xgb_model = XGBClassifier()`) and load the model with `xgb_model.load_model('model_name.xgb')` as noted in the comment from @ihebch."
  },
  "source": "meta"
}