{
  "id": 215327,
  "title": "Is groupkfold a valid cv strategy : Some discussion points",
  "url": "/competitions/ranzcr-clip-catheter-line-classification/discussion/215327",
  "author_name": "",
  "post_date": "2021-01-29T13:14:56.939326100Z",
  "votes": 8,
  "comment_count": 2,
  "views": 0,
  "content": "<p>I was working on creating a working baseline using public cv strategy as suggested by <a href=\"https://www.kaggle.com/yasufuminakama\" target=\"_blank\">@yasufuminakama</a> which uses GroupKfold splits where I encountered with this error  <em>ValueError: Only one class present in y_true. ROC AUC score is not defined in that case.</em><br>\nWhile digging it further, I realized there aren't enough positive sample values in some targets.</p>\n<p>I was wondering as the data is imbalanced, it could be hard for models to learn if there aren't enough positive sample. I believe having enough positive samples in every class of a fold should also help in the learning process of model.  So, what I really wanted to know is, shouldn't we prefer using <strong>Stratified+ Group Kfold</strong> for making splits in this competition?</p>\n<p>As I still lack experience and not a professional, I would really love to hear thoughts about it from the community. </p>\n<p>Thank you.</p>",
  "messages": [
    {
      "id": "1176028",
      "postDate": "01/29/2021 13:14:56",
      "content": "<p>I was working on creating a working baseline using public cv strategy as suggested by <a href=\"https://www.kaggle.com/yasufuminakama\" target=\"_blank\">@yasufuminakama</a> which uses GroupKfold splits where I encountered with this error  <em>ValueError: Only one class present in y_true. ROC AUC score is not defined in that case.</em><br>\nWhile digging it further, I realized there aren't enough positive sample values in some targets.</p>\n<p>I was wondering as the data is imbalanced, it could be hard for models to learn if there aren't enough positive sample. I believe having enough positive samples in every class of a fold should also help in the learning process of model.  So, what I really wanted to know is, shouldn't we prefer using <strong>Stratified+ Group Kfold</strong> for making splits in this competition?</p>\n<p>As I still lack experience and not a professional, I would really love to hear thoughts about it from the community. </p>\n<p>Thank you.</p>",
      "rawMarkdown": "I was working on creating a working baseline using public cv strategy as suggested by @yasufuminakama which uses GroupKfold splits where I encountered with this error  *ValueError: Only one class present in y_true. ROC AUC score is not defined in that case.*\nWhile digging it further, I realized there aren't enough positive sample values in some targets.\n\nI was wondering as the data is imbalanced, it could be hard for models to learn if there aren't enough positive sample. I believe having enough positive samples in every class of a fold should also help in the learning process of model.  So, what I really wanted to know is, shouldn't we prefer using **Stratified+ Group Kfold** for making splits in this competition?\n\nAs I still lack experience and not a professional, I would really love to hear thoughts about it from the community. \n\nThank you.",
      "votes": null
    },
    {
      "id": "1176985",
      "postDate": "01/30/2021 00:03:18",
      "content": "<p>GroupKFold doesn't enforce stratification but I think it is ok to use since it is almost stratified(<a href=\"https://www.kaggle.com/c/ranzcr-clip-catheter-line-classification/discussion/204638\" target=\"_blank\">https://www.kaggle.com/c/ranzcr-clip-catheter-line-classification/discussion/204638</a>) If you want to do StratifiedGroupKFold, you can refer to <a href=\"https://www.kaggle.com/underwearfitting/how-to-properly-split-folds\" target=\"_blank\">https://www.kaggle.com/underwearfitting/how-to-properly-split-folds</a> </p>",
      "rawMarkdown": "GroupKFold doesn't enforce stratification but I think it is ok to use since it is almost stratified(https://www.kaggle.com/c/ranzcr-clip-catheter-line-classification/discussion/204638) If you want to do StratifiedGroupKFold, you can refer to https://www.kaggle.com/underwearfitting/how-to-properly-split-folds",
      "votes": null
    },
    {
      "id": "1177825",
      "postDate": "01/30/2021 14:32:30",
      "content": "<p>Thank you for your feedback <a href=\"https://www.kaggle.com/harangdev\" target=\"_blank\">@harangdev</a>. </p>",
      "rawMarkdown": "Thank you for your feedback @harangdev.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1176985,
      "author_name": "harangdev",
      "author_url": "",
      "post_date": "01/30/2021 00:03:18",
      "content": "<p>GroupKFold doesn't enforce stratification but I think it is ok to use since it is almost stratified(<a href=\"https://www.kaggle.com/c/ranzcr-clip-catheter-line-classification/discussion/204638\" target=\"_blank\">https://www.kaggle.com/c/ranzcr-clip-catheter-line-classification/discussion/204638</a>) If you want to do StratifiedGroupKFold, you can refer to <a href=\"https://www.kaggle.com/underwearfitting/how-to-properly-split-folds\" target=\"_blank\">https://www.kaggle.com/underwearfitting/how-to-properly-split-folds</a> </p>",
      "votes": null,
      "replies": [
        {
          "id": 1177825,
          "author_name": "nischaydnk",
          "author_url": "",
          "post_date": "01/30/2021 14:32:30",
          "content": "<p>Thank you for your feedback <a href=\"https://www.kaggle.com/harangdev\" target=\"_blank\">@harangdev</a>. </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1176028": "I was working on creating a working baseline using public cv strategy as suggested by @yasufuminakama which uses GroupKfold splits where I encountered with this error  *ValueError: Only one class present in y_true. ROC AUC score is not defined in that case.*\nWhile digging it further, I realized there aren't enough positive sample values in some targets.\n\nI was wondering as the data is imbalanced, it could be hard for models to learn if there aren't enough positive sample. I believe having enough positive samples in every class of a fold should also help in the learning process of model.  So, what I really wanted to know is, shouldn't we prefer using **Stratified+ Group Kfold** for making splits in this competition?\n\nAs I still lack experience and not a professional, I would really love to hear thoughts about it from the community. \n\nThank you.",
    "1176985": "GroupKFold doesn't enforce stratification but I think it is ok to use since it is almost stratified(https://www.kaggle.com/c/ranzcr-clip-catheter-line-classification/discussion/204638) If you want to do StratifiedGroupKFold, you can refer to https://www.kaggle.com/underwearfitting/how-to-properly-split-folds",
    "1177825": "Thank you for your feedback @harangdev."
  },
  "source": "meta"
}