{
  "id": 73422,
  "title": "predict_proba is very slow",
  "url": "/competitions/PLAsTiCC-2018/discussion/73422",
  "author_name": "",
  "post_date": "2018-12-03T03:35:45.945766800Z",
  "votes": 1,
  "comment_count": 4,
  "views": 0,
  "content": "<p>I am using a Lightgbm model. The train takes less than 5min with 5Kfolds but when predicting it takes more than 45minutes for only  1 model. That means 45*5 = 225minutes in total for predicting.\nDoes the predict_proba method takes all this time? I am only using 54 features and these parameters \n 'boosting_type': 'gbdt',\n    'objective': 'multiclass',\n    'num_class':14,\n    'metric': 'multi_logloss',\n    'learning_rate': 0.008,\n    'num_leaves': 256, <br>\n    'max_depth': 4, <br>\n    'min_child_samples': 200, <br>\n    'subsample': 0.7, <br>\n    'subsample_freq': 1, <br>\n    'colsample_bytree': 0.7, <br>\n    'min_child_weight': 0,\n    'min_split_gain': 0, \n    'n_estimators': 20000,\n    'reg_alpha': 0, <br>\n    'reg_lambda': 0, </p>",
  "messages": [
    {
      "id": "431871",
      "postDate": "12/03/2018 03:35:45",
      "content": "<p>I am using a Lightgbm model. The train takes less than 5min with 5Kfolds but when predicting it takes more than 45minutes for only  1 model. That means 45*5 = 225minutes in total for predicting.\nDoes the predict_proba method takes all this time? I am only using 54 features and these parameters \n 'boosting_type': 'gbdt',\n    'objective': 'multiclass',\n    'num_class':14,\n    'metric': 'multi_logloss',\n    'learning_rate': 0.008,\n    'num_leaves': 256, <br>\n    'max_depth': 4, <br>\n    'min_child_samples': 200, <br>\n    'subsample': 0.7, <br>\n    'subsample_freq': 1, <br>\n    'colsample_bytree': 0.7, <br>\n    'min_child_weight': 0,\n    'min_split_gain': 0, \n    'n_estimators': 20000,\n    'reg_alpha': 0, <br>\n    'reg_lambda': 0, </p>",
      "rawMarkdown": "I am using a Lightgbm model. The train takes less than 5min with 5Kfolds but when predicting it takes more than 45minutes for only  1 model. That means 45*5 = 225minutes in total for predicting.\nDoes the predict_proba method takes all this time? I am only using 54 features and these parameters \n 'boosting_type': 'gbdt',\n    'objective': 'multiclass',\n    'num_class':14,\n    'metric': 'multi_logloss',\n    'learning_rate': 0.008,\n    'num_leaves': 256,  \n    'max_depth': 4,  \n    'min_child_samples': 200,   \n    'subsample': 0.7,  \n    'subsample_freq': 1,  \n    'colsample_bytree': 0.7,  \n    'min_child_weight': 0,\n    'min_split_gain': 0, \n    'n_estimators': 20000,\n    'reg_alpha': 0,  \n    'reg_lambda': 0,",
      "votes": null
    },
    {
      "id": "431893",
      "postDate": "12/03/2018 04:13:51",
      "content": "<blockquote>\n  <p>'nestimators': 20000,</p>\n</blockquote>\n\n<p>That's a lot.  Prediction time is proportional to the number of trees.</p>",
      "rawMarkdown": "&gt;  'nestimators': 20000,\n\nThat's a lot.  Prediction time is proportional to the number of trees.",
      "votes": null
    },
    {
      "id": "431897",
      "postDate": "12/03/2018 04:27:00",
      "content": "<p>But all the models early stop after about 1500 iterations...</p>",
      "rawMarkdown": "But all the models early stop after about 1500 iterations...",
      "votes": null
    },
    {
      "id": "431928",
      "postDate": "12/03/2018 05:28:46",
      "content": "<p>you don't have early stopping in your post..</p>\n\n<p>Anyway, your running time does not look that large, if you have a single cpu machine.  Test data is way larger than train. </p>\n\n<p>Are you predicting on all test data at once or by chunks?  </p>",
      "rawMarkdown": "you don't have early stopping in your post..\n\nAnyway, your running time does not look that large, if you have a single cpu machine.  Test data is way larger than train. \n\nAre you predicting on all test data at once or by chunks?",
      "votes": null
    },
    {
      "id": "431941",
      "postDate": "12/03/2018 06:08:13",
      "content": "<p>I am using Kaggle kernel so it is by chunks.\nI changed the learning  rate to 0.05 so the models early stop after 300 iterations and the prediction is faster from 45minutes to 5minutes.\nThank you @CPMP </p>",
      "rawMarkdown": "I am using Kaggle kernel so it is by chunks.\nI changed the learning  rate to 0.05 so the models early stop after 300 iterations and the prediction is faster from 45minutes to 5minutes.\nThank you @CPMP",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 431893,
      "author_name": "cpmpml",
      "author_url": "",
      "post_date": "12/03/2018 04:13:51",
      "content": "<blockquote>\n  <p>'nestimators': 20000,</p>\n</blockquote>\n\n<p>That's a lot.  Prediction time is proportional to the number of trees.</p>",
      "votes": null,
      "replies": [
        {
          "id": 431897,
          "author_name": "rinnqd",
          "author_url": "",
          "post_date": "12/03/2018 04:27:00",
          "content": "<p>But all the models early stop after about 1500 iterations...</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 431928,
          "author_name": "cpmpml",
          "author_url": "",
          "post_date": "12/03/2018 05:28:46",
          "content": "<p>you don't have early stopping in your post..</p>\n\n<p>Anyway, your running time does not look that large, if you have a single cpu machine.  Test data is way larger than train. </p>\n\n<p>Are you predicting on all test data at once or by chunks?  </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 431941,
          "author_name": "rinnqd",
          "author_url": "",
          "post_date": "12/03/2018 06:08:13",
          "content": "<p>I am using Kaggle kernel so it is by chunks.\nI changed the learning  rate to 0.05 so the models early stop after 300 iterations and the prediction is faster from 45minutes to 5minutes.\nThank you @CPMP </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "431871": "I am using a Lightgbm model. The train takes less than 5min with 5Kfolds but when predicting it takes more than 45minutes for only  1 model. That means 45*5 = 225minutes in total for predicting.\nDoes the predict_proba method takes all this time? I am only using 54 features and these parameters \n 'boosting_type': 'gbdt',\n    'objective': 'multiclass',\n    'num_class':14,\n    'metric': 'multi_logloss',\n    'learning_rate': 0.008,\n    'num_leaves': 256,  \n    'max_depth': 4,  \n    'min_child_samples': 200,   \n    'subsample': 0.7,  \n    'subsample_freq': 1,  \n    'colsample_bytree': 0.7,  \n    'min_child_weight': 0,\n    'min_split_gain': 0, \n    'n_estimators': 20000,\n    'reg_alpha': 0,  \n    'reg_lambda': 0,",
    "431893": "&gt;  'nestimators': 20000,\n\nThat's a lot.  Prediction time is proportional to the number of trees.",
    "431897": "But all the models early stop after about 1500 iterations...",
    "431928": "you don't have early stopping in your post..\n\nAnyway, your running time does not look that large, if you have a single cpu machine.  Test data is way larger than train. \n\nAre you predicting on all test data at once or by chunks?",
    "431941": "I am using Kaggle kernel so it is by chunks.\nI changed the learning  rate to 0.05 so the models early stop after 300 iterations and the prediction is faster from 45minutes to 5minutes.\nThank you @CPMP"
  },
  "source": "meta"
}