{
  "id": 95090,
  "title": "Metric to be used with LightGBM",
  "url": "/competitions/champs-scalar-coupling/discussion/95090",
  "author_name": "",
  "post_date": "2019-06-09T22:46:25.358729300Z",
  "votes": 7,
  "comment_count": 1,
  "views": 0,
  "content": "<p><code>\ndef logmae(preds, train_data):\n    maes = (preds - train_data.get_label()).abs().groupby(train_data.get_data().type).mean()\n    return 'logmae', np.log(maes.map(lambda x: max(x, 1e-9))).mean(), False`\n</code>\nAdapt from the <a href=\"https://www.kaggle.com/uberkinder/efficient-metric\">https://www.kaggle.com/uberkinder/efficient-metric</a> kernel\nTo be use as a feval parameter in the train() lightgbm method \n<a href=\"https://lightgbm.readthedocs.io/en/latest/Python-API.html#training-api\">https://lightgbm.readthedocs.io/en/latest/Python-API.html#training-api</a></p>\n\n<p>Of course it will slow down the training.\nIf you have a faster way, please let me know</p>",
  "messages": [
    {
      "id": "548789",
      "postDate": "06/09/2019 22:46:25",
      "content": "<p><code>\ndef logmae(preds, train_data):\n    maes = (preds - train_data.get_label()).abs().groupby(train_data.get_data().type).mean()\n    return 'logmae', np.log(maes.map(lambda x: max(x, 1e-9))).mean(), False`\n</code>\nAdapt from the <a href=\"https://www.kaggle.com/uberkinder/efficient-metric\">https://www.kaggle.com/uberkinder/efficient-metric</a> kernel\nTo be use as a feval parameter in the train() lightgbm method \n<a href=\"https://lightgbm.readthedocs.io/en/latest/Python-API.html#training-api\">https://lightgbm.readthedocs.io/en/latest/Python-API.html#training-api</a></p>\n\n<p>Of course it will slow down the training.\nIf you have a faster way, please let me know</p>",
      "rawMarkdown": "```\ndef logmae(preds, train_data):\n    maes = (preds - train_data.get_label()).abs().groupby(train_data.get_data().type).mean()\n    return 'logmae', np.log(maes.map(lambda x: max(x, 1e-9))).mean(), False`\n```\nAdapt from the https://www.kaggle.com/uberkinder/efficient-metric kernel\nTo be use as a feval parameter in the train() lightgbm method \nhttps://lightgbm.readthedocs.io/en/latest/Python-API.html#training-api\n\nOf course it will slow down the training.\nIf you have a faster way, please let me know",
      "votes": null
    },
    {
      "id": "549534",
      "postDate": "06/10/2019 19:08:06",
      "content": "<p>Good Job</p>",
      "rawMarkdown": "Good Job",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 549534,
      "author_name": "singletonai",
      "author_url": "",
      "post_date": "06/10/2019 19:08:06",
      "content": "<p>Good Job</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "548789": "```\ndef logmae(preds, train_data):\n    maes = (preds - train_data.get_label()).abs().groupby(train_data.get_data().type).mean()\n    return 'logmae', np.log(maes.map(lambda x: max(x, 1e-9))).mean(), False`\n```\nAdapt from the https://www.kaggle.com/uberkinder/efficient-metric kernel\nTo be use as a feval parameter in the train() lightgbm method \nhttps://lightgbm.readthedocs.io/en/latest/Python-API.html#training-api\n\nOf course it will slow down the training.\nIf you have a faster way, please let me know",
    "549534": "Good Job"
  },
  "source": "meta"
}