{
  "id": 200696,
  "title": "Loss Functions for Multiclass imbalanced data",
  "url": "/competitions/cassava-leaf-disease-classification/discussion/200696",
  "author_name": "DeepUnderstanding",
  "post_date": "2020-12-01T13:25:13.693000",
  "votes": 8,
  "comment_count": 8,
  "views": 0,
  "content": "<p>As we know the data is unbalanced.Also since the evaluation metric is Accuracy which is not a good metric when dealing with imbalanced data.<br>\nI am using Crossentropy loss with Weights, but I think there is some better loss function to deal with this imbalance problem.<br>\nCan you guys suggest some better losses for the competition?<br>\nThank you.</p>",
  "messages": [
    {
      "id": 1098158,
      "postDate": "2020-12-01T13:25:13.693Z",
      "content": "<p>As we know the data is unbalanced.Also since the evaluation metric is Accuracy which is not a good metric when dealing with imbalanced data.<br>\nI am using Crossentropy loss with Weights, but I think there is some better loss function to deal with this imbalance problem.<br>\nCan you guys suggest some better losses for the competition?<br>\nThank you.</p>",
      "rawMarkdown": "As we know the data is unbalanced.Also since the evaluation metric is Accuracy which is not a good metric when dealing with imbalanced data.\nI am using Crossentropy loss with Weights, but I think there is some better loss function to deal with this imbalance problem.\nCan you guys suggest some better losses for the competition?\nThank you.",
      "votes": 8
    },
    {
      "id": 1098376,
      "postDate": "2020-12-01T15:57:27.203Z",
      "content": "<p>you could also try focal loss. in my experience the overall results will be better but the problems for minority classes still will not improve much.</p>",
      "rawMarkdown": "you could also try focal loss. in my experience the overall results will be better but the problems for minority classes still will not improve much.",
      "votes": 3,
      "replies": [
        {
          "id": 1098383,
          "postDate": "2020-12-01T16:02:36.137Z",
          "content": "<p>Thank you for the suggestion; Are you using it?</p>",
          "rawMarkdown": "Thank you for the suggestion; Are you using it?\n"
        },
        {
          "id": 1098396,
          "postDate": "2020-12-01T16:06:41.470Z",
          "content": "<p>Haven't tried it yet. But I will.</p>",
          "rawMarkdown": "Haven't tried it yet. But I will."
        }
      ]
    },
    {
      "id": 1100326,
      "postDate": "2020-12-03T02:11:37.063Z",
      "content": "<p>Why correct the imbalance with weights if the test set has similar distribution? If the metric was F1 it would be a different story</p>",
      "rawMarkdown": "Why correct the imbalance with weights if the test set has similar distribution? If the metric was F1 it would be a different story",
      "votes": 1,
      "replies": [
        {
          "id": 1100459,
          "postDate": "2020-12-03T05:14:07.783Z",
          "content": "<p>Even if the test set has similar distributions, the data in the test set may not be balanced. In order to balance the various types, a balance function is needed to appropriately give some preferential treatment to the minority class and amplify the features of the minority class to balance the majority class. This is possible Truly reflect the current status of the test set</p>",
          "rawMarkdown": "Even if the test set has similar distributions, the data in the test set may not be balanced. In order to balance the various types, a balance function is needed to appropriately give some preferential treatment to the minority class and amplify the features of the minority class to balance the majority class. This is possible Truly reflect the current status of the test set",
          "votes": 2
        },
        {
          "id": 1101000,
          "postDate": "2020-12-03T14:41:58.990Z",
          "content": "<p>Adding weight to the loss increases your recall score of the less represented class, not necessairly the accuracy. If the metric of this competition was F1 or reacall score adding weights would have a benefit </p>",
          "rawMarkdown": "Adding weight to the loss increases your recall score of the less represented class, not necessairly the accuracy. If the metric of this competition was F1 or reacall score adding weights would have a benefit "
        }
      ]
    },
    {
      "id": 1098384,
      "postDate": "2020-12-01T16:02:53.253Z",
      "content": "<p>I have heard of OHEM loss and Focal loss at the time of Bangali.ai competition but haven't tried them yet. Here are good reference threads with code:</p>\n<ul>\n<li><a href=\"https://www.kaggle.com/c/bengaliai-cv19/discussion/128665\" target=\"_blank\">https://www.kaggle.com/c/bengaliai-cv19/discussion/128665</a></li>\n<li><a href=\"https://www.kaggle.com/c/bengaliai-cv19/discussion/128637\" target=\"_blank\">https://www.kaggle.com/c/bengaliai-cv19/discussion/128637</a></li>\n</ul>",
      "rawMarkdown": "I have heard of OHEM loss and Focal loss at the time of Bangali.ai competition but haven't tried them yet. Here are good reference threads with code:\n- https://www.kaggle.com/c/bengaliai-cv19/discussion/128665\n- https://www.kaggle.com/c/bengaliai-cv19/discussion/128637",
      "votes": 1
    },
    {
      "id": 1159420,
      "postDate": "2021-01-19T08:40:51.930Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 1098376,
      "author_name": "Nicu",
      "author_url": "",
      "post_date": "2020-12-01T15:57:27.203000",
      "content": "<p>you could also try focal loss. in my experience the overall results will be better but the problems for minority classes still will not improve much.</p>",
      "votes": 3,
      "replies": [
        {
          "id": 1098383,
          "author_name": "DeepUnderstanding",
          "author_url": "",
          "post_date": "2020-12-01T16:02:36.137000",
          "content": "<p>Thank you for the suggestion; Are you using it?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1098396,
          "author_name": "Nicu",
          "author_url": "",
          "post_date": "2020-12-01T16:06:41.470000",
          "content": "<p>Haven't tried it yet. But I will.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1100326,
      "author_name": "Yann Majewski",
      "author_url": "",
      "post_date": "2020-12-03T02:11:37.063000",
      "content": "<p>Why correct the imbalance with weights if the test set has similar distribution? If the metric was F1 it would be a different story</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1100459,
          "author_name": "zhangeng",
          "author_url": "",
          "post_date": "2020-12-03T05:14:07.783000",
          "content": "<p>Even if the test set has similar distributions, the data in the test set may not be balanced. In order to balance the various types, a balance function is needed to appropriately give some preferential treatment to the minority class and amplify the features of the minority class to balance the majority class. This is possible Truly reflect the current status of the test set</p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 1101000,
          "author_name": "Yann Majewski",
          "author_url": "",
          "post_date": "2020-12-03T14:41:58.990000",
          "content": "<p>Adding weight to the loss increases your recall score of the less represented class, not necessairly the accuracy. If the metric of this competition was F1 or reacall score adding weights would have a benefit </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1098384,
      "author_name": "Kaushal Shah",
      "author_url": "",
      "post_date": "2020-12-01T16:02:53.253000",
      "content": "<p>I have heard of OHEM loss and Focal loss at the time of Bangali.ai competition but haven't tried them yet. Here are good reference threads with code:</p>\n<ul>\n<li><a href=\"https://www.kaggle.com/c/bengaliai-cv19/discussion/128665\" target=\"_blank\">https://www.kaggle.com/c/bengaliai-cv19/discussion/128665</a></li>\n<li><a href=\"https://www.kaggle.com/c/bengaliai-cv19/discussion/128637\" target=\"_blank\">https://www.kaggle.com/c/bengaliai-cv19/discussion/128637</a></li>\n</ul>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1159420,
      "author_name": "",
      "author_url": "",
      "post_date": "2021-01-19T08:40:51.930000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1098158": "As we know the data is unbalanced.Also since the evaluation metric is Accuracy which is not a good metric when dealing with imbalanced data.\nI am using Crossentropy loss with Weights, but I think there is some better loss function to deal with this imbalance problem.\nCan you guys suggest some better losses for the competition?\nThank you.",
    "1098376": "you could also try focal loss. in my experience the overall results will be better but the problems for minority classes still will not improve much.",
    "1100326": "Why correct the imbalance with weights if the test set has similar distribution? If the metric was F1 it would be a different story",
    "1098384": "I have heard of OHEM loss and Focal loss at the time of Bangali.ai competition but haven't tried them yet. Here are good reference threads with code:\n- https://www.kaggle.com/c/bengaliai-cv19/discussion/128665\n- https://www.kaggle.com/c/bengaliai-cv19/discussion/128637",
    "1159420": ""
  }
}