{
  "id": 173063,
  "title": "Train model with class weight ( [0.5478529  5.72434391] )",
  "url": "/competitions/siim-isic-melanoma-classification/discussion/173063",
  "author_name": "",
  "post_date": "2020-08-07T17:15:08.867335400Z",
  "votes": 1,
  "comment_count": 1,
  "views": 0,
  "content": "<p>If want to use only BCE for imbalance , balance model using class weight<br>\nI trained one , model and got score of .9457</p>\n<p>How to find class weight is as :</p>\n<pre><code>m20 = pd.read_csv('../input/melanoma-512x512/train.csv')\nm19 = pd.read_csv('../input/isic2019-512x512/train.csv')\ndf = pd.concat([ m20[['image_name','target']],m19[['image_name','target']] ])\n\nimport sklearn\nprint(sklearn.utils.class_weight.compute_class_weight('balanced',\n                                                      np.unique(df.target),df.target))\n</code></pre>\n<p>[0.5478529  5.72434391]</p>\n<p>👉change it a little bit up and down to fine tune.</p>",
  "messages": [
    {
      "id": "961976",
      "postDate": "08/07/2020 17:15:08",
      "content": "<p>If want to use only BCE for imbalance , balance model using class weight<br>\nI trained one , model and got score of .9457</p>\n<p>How to find class weight is as :</p>\n<pre><code>m20 = pd.read_csv('../input/melanoma-512x512/train.csv')\nm19 = pd.read_csv('../input/isic2019-512x512/train.csv')\ndf = pd.concat([ m20[['image_name','target']],m19[['image_name','target']] ])\n\nimport sklearn\nprint(sklearn.utils.class_weight.compute_class_weight('balanced',\n                                                      np.unique(df.target),df.target))\n</code></pre>\n<p>[0.5478529  5.72434391]</p>\n<p>👉change it a little bit up and down to fine tune.</p>",
      "rawMarkdown": "If want to use only BCE for imbalance , balance model using class weight\nI trained one , model and got score of .9457\n\nHow to find class weight is as :\n\n```\nm20 = pd.read_csv('../input/melanoma-512x512/train.csv')\nm19 = pd.read_csv('../input/isic2019-512x512/train.csv')\ndf = pd.concat([ m20[['image_name','target']],m19[['image_name','target']] ])\n\nimport sklearn\nprint(sklearn.utils.class_weight.compute_class_weight('balanced',\n                                                      np.unique(df.target),df.target))\n\n```\n[0.5478529  5.72434391]\n\n👉change it a little bit up and down to fine tune.",
      "votes": null
    },
    {
      "id": "962328",
      "postDate": "08/08/2020 03:58:22",
      "content": "<p>It depends on whether you are doing Upsampling or not</p>",
      "rawMarkdown": "It depends on whether you are doing Upsampling or not",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 962328,
      "author_name": "msharuk589",
      "author_url": "",
      "post_date": "08/08/2020 03:58:22",
      "content": "<p>It depends on whether you are doing Upsampling or not</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "961976": "If want to use only BCE for imbalance , balance model using class weight\nI trained one , model and got score of .9457\n\nHow to find class weight is as :\n\n```\nm20 = pd.read_csv('../input/melanoma-512x512/train.csv')\nm19 = pd.read_csv('../input/isic2019-512x512/train.csv')\ndf = pd.concat([ m20[['image_name','target']],m19[['image_name','target']] ])\n\nimport sklearn\nprint(sklearn.utils.class_weight.compute_class_weight('balanced',\n                                                      np.unique(df.target),df.target))\n\n```\n[0.5478529  5.72434391]\n\n👉change it a little bit up and down to fine tune.",
    "962328": "It depends on whether you are doing Upsampling or not"
  },
  "source": "meta"
}