{
  "id": 152183,
  "title": "What loss function to use for quadratic weighted kappa?",
  "url": "/competitions/prostate-cancer-grade-assessment/discussion/152183",
  "author_name": "yuvaramsingh",
  "post_date": "2020-05-18T18:48:46.794000",
  "votes": 1,
  "comment_count": 4,
  "views": 0,
  "content": "<p>Hi all,\n    i am starting this thread to discuss on what loss function to use for this challenge. i have so far used CategoricalCrossentropy but the results are not grate . i have tried various CNN feature extractors starting from densenet to resnext but no luck . the CV caps at 67% while my LB is at 60% . \ni would like to know about what am i doing wrong and i like to learn from it. kindly share some insides.</p>\n\n<p>thanks</p>",
  "messages": [
    {
      "id": 852890,
      "postDate": "2020-05-18T19:03:27.120Z",
      "content": "<p>Crossentropy is acceptable for now. If you are in the 60% range it's probably more a data problem (what you are feeding to the model) and using better input (like the tile method in the public kernels) will give you a good jump.</p>\n\n<p>For loss the labels are more than categorical. They are ordinal. (quadratic) Weighted Kappa penalizes more big differences in rating than small ones (contrary to say accuracy for a typical categorical problem). Crossentropy penalizes mistakes in classification the same way which therefore make it well correlated with a metric like accuracy. On the other hand Weighted Kappa is often used with regression and (root)squared error because of the better correlation between the two. The trick though is that you will have to use a threshold optimizer (if not a simple round operation). For example the regression will give you 3.56 you need now a threshold to say whether this is a 3 or a 4.</p>\n\n<p>That being said I only got a small improvement going from classification to regression so if you are below the 80 range there are more important things to fix first.</p>",
      "rawMarkdown": "Crossentropy is acceptable for now. If you are in the 60% range it's probably more a data problem (what you are feeding to the model) and using better input (like the tile method in the public kernels) will give you a good jump.\n\nFor loss the labels are more than categorical. They are ordinal. (quadratic) Weighted Kappa penalizes more big differences in rating than small ones (contrary to say accuracy for a typical categorical problem). Crossentropy penalizes mistakes in classification the same way which therefore make it well correlated with a metric like accuracy. On the other hand Weighted Kappa is often used with regression and (root)squared error because of the better correlation between the two. The trick though is that you will have to use a threshold optimizer (if not a simple round operation). For example the regression will give you 3.56 you need now a threshold to say whether this is a 3 or a 4.\n\nThat being said I only got a small improvement going from classification to regression so if you are below the 80 range there are more important things to fix first.",
      "votes": 4,
      "replies": [
        {
          "id": 854158,
          "postDate": "2020-05-19T19:55:57.383Z",
          "content": "<p>Thanks for sharing info about regression and RMS. my model currently is trained on tile based input from lower resolution. do you think if i move to higher resolution will it help?. i am also adding augmentation. \nbasically i glue the tiles to form a single image where i randomly augment 30% of tile. implemented lr reduction on plateau with adamw optimizer </p>\n\n<p>i am not sure what new i can do on the data side. any idea or am i missing something.</p>",
          "rawMarkdown": "Thanks for sharing info about regression and RMS. my model currently is trained on tile based input from lower resolution. do you think if i move to higher resolution will it help?. i am also adding augmentation. \nbasically i glue the tiles to form a single image where i randomly augment 30% of tile. implemented lr reduction on plateau with adamw optimizer \n\ni am not sure what new i can do on the data side. any idea or am i missing something.\n"
        },
        {
          "id": 854193,
          "postDate": "2020-05-19T20:47:33.790Z",
          "content": "<p>I don't think gluing into a single image makes sense. Your model is likely using convolutions so you will have some calculations that will happen across multiple tiles trying to find a pattern there... but that pattern is 100% noise since you likely glue them in an arbitrary manner. </p>\n\n<p>A CNN should only be applied onto spatially coherent data. Try applying your CNN (the backbone part of it) to individual tiles and then aggregate the results of each tile representation.</p>",
          "rawMarkdown": "I don't think gluing into a single image makes sense. Your model is likely using convolutions so you will have some calculations that will happen across multiple tiles trying to find a pattern there... but that pattern is 100% noise since you likely glue them in an arbitrary manner. \n\nA CNN should only be applied onto spatially coherent data. Try applying your CNN (the backbone part of it) to individual tiles and then aggregate the results of each tile representation.",
          "votes": 1
        },
        {
          "id": 854675,
          "postDate": "2020-05-20T08:04:34.717Z",
          "content": "<p>i will try passing the patches individually and use the feature extractor for prediction. Thanks\nfor help . </p>",
          "rawMarkdown": "i will try passing the patches individually and use the feature extractor for prediction. Thanks\nfor help . "
        }
      ]
    },
    {
      "id": 852882,
      "postDate": "2020-05-18T18:48:46.793Z",
      "content": "<p>Hi all,\n    i am starting this thread to discuss on what loss function to use for this challenge. i have so far used CategoricalCrossentropy but the results are not grate . i have tried various CNN feature extractors starting from densenet to resnext but no luck . the CV caps at 67% while my LB is at 60% . \ni would like to know about what am i doing wrong and i like to learn from it. kindly share some insides.</p>\n\n<p>thanks</p>",
      "rawMarkdown": "Hi all,\n    i am starting this thread to discuss on what loss function to use for this challenge. i have so far used CategoricalCrossentropy but the results are not grate . i have tried various CNN feature extractors starting from densenet to resnext but no luck . the CV caps at 67% while my LB is at 60% . \ni would like to know about what am i doing wrong and i like to learn from it. kindly share some insides.\n\nthanks\n",
      "votes": 1
    }
  ],
  "comments": [
    {
      "id": 852890,
      "author_name": "Arnaud Roussel",
      "author_url": "",
      "post_date": "2020-05-18T19:03:27.120000",
      "content": "<p>Crossentropy is acceptable for now. If you are in the 60% range it's probably more a data problem (what you are feeding to the model) and using better input (like the tile method in the public kernels) will give you a good jump.</p>\n\n<p>For loss the labels are more than categorical. They are ordinal. (quadratic) Weighted Kappa penalizes more big differences in rating than small ones (contrary to say accuracy for a typical categorical problem). Crossentropy penalizes mistakes in classification the same way which therefore make it well correlated with a metric like accuracy. On the other hand Weighted Kappa is often used with regression and (root)squared error because of the better correlation between the two. The trick though is that you will have to use a threshold optimizer (if not a simple round operation). For example the regression will give you 3.56 you need now a threshold to say whether this is a 3 or a 4.</p>\n\n<p>That being said I only got a small improvement going from classification to regression so if you are below the 80 range there are more important things to fix first.</p>",
      "votes": 4,
      "replies": [
        {
          "id": 854158,
          "author_name": "yuvaramsingh",
          "author_url": "",
          "post_date": "2020-05-19T19:55:57.383000",
          "content": "<p>Thanks for sharing info about regression and RMS. my model currently is trained on tile based input from lower resolution. do you think if i move to higher resolution will it help?. i am also adding augmentation. \nbasically i glue the tiles to form a single image where i randomly augment 30% of tile. implemented lr reduction on plateau with adamw optimizer </p>\n\n<p>i am not sure what new i can do on the data side. any idea or am i missing something.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 854193,
          "author_name": "Arnaud Roussel",
          "author_url": "",
          "post_date": "2020-05-19T20:47:33.790000",
          "content": "<p>I don't think gluing into a single image makes sense. Your model is likely using convolutions so you will have some calculations that will happen across multiple tiles trying to find a pattern there... but that pattern is 100% noise since you likely glue them in an arbitrary manner. </p>\n\n<p>A CNN should only be applied onto spatially coherent data. Try applying your CNN (the backbone part of it) to individual tiles and then aggregate the results of each tile representation.</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 854675,
          "author_name": "yuvaramsingh",
          "author_url": "",
          "post_date": "2020-05-20T08:04:34.717000",
          "content": "<p>i will try passing the patches individually and use the feature extractor for prediction. Thanks\nfor help . </p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "852890": "Crossentropy is acceptable for now. If you are in the 60% range it's probably more a data problem (what you are feeding to the model) and using better input (like the tile method in the public kernels) will give you a good jump.\n\nFor loss the labels are more than categorical. They are ordinal. (quadratic) Weighted Kappa penalizes more big differences in rating than small ones (contrary to say accuracy for a typical categorical problem). Crossentropy penalizes mistakes in classification the same way which therefore make it well correlated with a metric like accuracy. On the other hand Weighted Kappa is often used with regression and (root)squared error because of the better correlation between the two. The trick though is that you will have to use a threshold optimizer (if not a simple round operation). For example the regression will give you 3.56 you need now a threshold to say whether this is a 3 or a 4.\n\nThat being said I only got a small improvement going from classification to regression so if you are below the 80 range there are more important things to fix first.",
    "852882": "Hi all,\n    i am starting this thread to discuss on what loss function to use for this challenge. i have so far used CategoricalCrossentropy but the results are not grate . i have tried various CNN feature extractors starting from densenet to resnext but no luck . the CV caps at 67% while my LB is at 60% . \ni would like to know about what am i doing wrong and i like to learn from it. kindly share some insides.\n\nthanks\n"
  }
}