{
  "id": 78790,
  "title": "Has anyone tried class-balanced loss?",
  "url": "/competitions/quora-insincere-questions-classification/discussion/78790",
  "author_name": "mhiro2",
  "post_date": "2019-01-27T21:43:32.614000",
  "votes": 5,
  "comment_count": 7,
  "views": 0,
  "content": "<p>I tried to use Focal loss or some regression loss, but no improvement for me. \nHas anyone tried class-balanced loss? Does it improve your score?</p>\n\n<p><a href=\"https://arxiv.org/abs/1901.05555\">https://arxiv.org/abs/1901.05555</a></p>",
  "messages": [
    {
      "id": 462210,
      "postDate": "2019-01-27T21:43:32.613Z",
      "content": "<p>I tried to use Focal loss or some regression loss, but no improvement for me. \nHas anyone tried class-balanced loss? Does it improve your score?</p>\n\n<p><a href=\"https://arxiv.org/abs/1901.05555\">https://arxiv.org/abs/1901.05555</a></p>",
      "rawMarkdown": "I tried to use Focal loss or some regression loss, but no improvement for me. \nHas anyone tried class-balanced loss? Does it improve your score?\n\nhttps://arxiv.org/abs/1901.05555",
      "votes": 5
    },
    {
      "id": 464992,
      "postDate": "2019-02-02T01:29:03.583Z",
      "content": "<p>I have no improvement with focal loss too. After using focal loss the threshold would be close to 0.5 (like 0.42) and with bce loss the threshold would be close to 0.3. Unbalanced threshold may have already considered the effects of unbalanced classes and this may be why focal loss doesn't improve the performance.</p>",
      "rawMarkdown": "I have no improvement with focal loss too. After using focal loss the threshold would be close to 0.5 (like 0.42) and with bce loss the threshold would be close to 0.3. Unbalanced threshold may have already considered the effects of unbalanced classes and this may be why focal loss doesn't improve the performance.",
      "votes": 3
    },
    {
      "id": 462795,
      "postDate": "2019-01-28T23:03:40.123Z",
      "content": "<p>I found that weighted losses only had poor performance during the 'burn in' period of training an embedding-&gt; RNN model. They will work, however.</p>",
      "rawMarkdown": "I found that weighted losses only had poor performance during the 'burn in' period of training an embedding-&gt; RNN model. They will work, however.",
      "votes": 1
    },
    {
      "id": 462382,
      "postDate": "2019-01-28T08:13:59.310Z",
      "content": "<p>I have no improvement with focal loss as well.</p>",
      "rawMarkdown": "I have no improvement with focal loss as well.",
      "votes": 1
    },
    {
      "id": 462251,
      "postDate": "2019-01-28T01:02:42.370Z",
      "content": "<p>Also tried focal loss and setting class weights, doesn't seem to help...</p>",
      "rawMarkdown": "Also tried focal loss and setting class weights, doesn't seem to help...",
      "votes": 2
    },
    {
      "id": 462901,
      "postDate": "2019-01-29T04:51:52.627Z",
      "content": "<p>maybe we should carefully fine-tuing alpha and gamma in focal loss</p>",
      "rawMarkdown": "maybe we should carefully fine-tuing alpha and gamma in focal loss"
    },
    {
      "id": 462527,
      "postDate": "2019-01-28T12:55:40.567Z",
      "content": "<p>I tried to up-weight the \"unsincere\" a bit during training with class_weight argument in Keras; but it had no measurable effect on performance as measured with a hold out-set.\nI guess it is because despite high level of unbalance,  the \"unsincere\" have &gt;80000 examples which is very large ... but did not further investigate.\nThanks for the reference</p>",
      "rawMarkdown": "I tried to up-weight the \"unsincere\" a bit during training with class_weight argument in Keras; but it had no measurable effect on performance as measured with a hold out-set.\nI guess it is because despite high level of unbalance,  the \"unsincere\" have &gt;80000 examples which is very large ... but did not further investigate.\nThanks for the reference",
      "votes": 6,
      "isDeleted": true,
      "replies": [
        {
          "id": 462875,
          "postDate": "2019-01-29T03:26:06.120Z",
          "content": "<p>Thanks for your insight. I wonder which loss function is the most suitable...\nBut unweighted binary cross entropy works well in most cases from my understanding.</p>",
          "rawMarkdown": "Thanks for your insight. I wonder which loss function is the most suitable...\nBut unweighted binary cross entropy works well in most cases from my understanding."
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 464992,
      "author_name": "jionie",
      "author_url": "",
      "post_date": "2019-02-02T01:29:03.583000",
      "content": "<p>I have no improvement with focal loss too. After using focal loss the threshold would be close to 0.5 (like 0.42) and with bce loss the threshold would be close to 0.3. Unbalanced threshold may have already considered the effects of unbalanced classes and this may be why focal loss doesn't improve the performance.</p>",
      "votes": 3,
      "replies": []
    },
    {
      "id": 462795,
      "author_name": "Alan Khoa Nguyen",
      "author_url": "",
      "post_date": "2019-01-28T23:03:40.123000",
      "content": "<p>I found that weighted losses only had poor performance during the 'burn in' period of training an embedding-&gt; RNN model. They will work, however.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 462382,
      "author_name": "antklen",
      "author_url": "",
      "post_date": "2019-01-28T08:13:59.310000",
      "content": "<p>I have no improvement with focal loss as well.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 462251,
      "author_name": "luyaxin",
      "author_url": "",
      "post_date": "2019-01-28T01:02:42.370000",
      "content": "<p>Also tried focal loss and setting class weights, doesn't seem to help...</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 462901,
      "author_name": "YaoZeng",
      "author_url": "",
      "post_date": "2019-01-29T04:51:52.627000",
      "content": "<p>maybe we should carefully fine-tuing alpha and gamma in focal loss</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 462527,
      "author_name": "",
      "author_url": "",
      "post_date": "2019-01-28T12:55:40.567000",
      "content": "<p>I tried to up-weight the \"unsincere\" a bit during training with class_weight argument in Keras; but it had no measurable effect on performance as measured with a hold out-set.\nI guess it is because despite high level of unbalance,  the \"unsincere\" have &gt;80000 examples which is very large ... but did not further investigate.\nThanks for the reference</p>",
      "votes": 6,
      "replies": [
        {
          "id": 462875,
          "author_name": "mhiro2",
          "author_url": "",
          "post_date": "2019-01-29T03:26:06.120000",
          "content": "<p>Thanks for your insight. I wonder which loss function is the most suitable...\nBut unweighted binary cross entropy works well in most cases from my understanding.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "462210": "I tried to use Focal loss or some regression loss, but no improvement for me. \nHas anyone tried class-balanced loss? Does it improve your score?\n\nhttps://arxiv.org/abs/1901.05555",
    "464992": "I have no improvement with focal loss too. After using focal loss the threshold would be close to 0.5 (like 0.42) and with bce loss the threshold would be close to 0.3. Unbalanced threshold may have already considered the effects of unbalanced classes and this may be why focal loss doesn't improve the performance.",
    "462795": "I found that weighted losses only had poor performance during the 'burn in' period of training an embedding-&gt; RNN model. They will work, however.",
    "462382": "I have no improvement with focal loss as well.",
    "462251": "Also tried focal loss and setting class weights, doesn't seem to help...",
    "462901": "maybe we should carefully fine-tuing alpha and gamma in focal loss",
    "462527": "I tried to up-weight the \"unsincere\" a bit during training with class_weight argument in Keras; but it had no measurable effect on performance as measured with a hold out-set.\nI guess it is because despite high level of unbalance,  the \"unsincere\" have &gt;80000 examples which is very large ... but did not further investigate.\nThanks for the reference"
  }
}