{
  "id": 222775,
  "title": "About behavior of GroupKFold",
  "url": "/competitions/ranzcr-clip-catheter-line-classification/discussion/222775",
  "author_name": "",
  "post_date": "2021-03-01T04:20:40.378818500Z",
  "votes": 3,
  "comment_count": 5,
  "views": 0,
  "content": "<p>I run GroupKFold and found that the data is devided into stratified with \"ETT - Abnormal\" like below.</p>\n<pre><code>fold  ETT - Abnormal\n0     0                 6000\n      1                   17\n1     0                 6001\n      1                   16\n2     0                 5999\n      1                   18\n3     0                 6004\n      1                   12\n4     0                 6000\n      1                   16\ndtype: int64\n</code></pre>\n<p>Is this a coincidence?<br>\nOr by design of GroupKFold?</p>",
  "messages": [
    {
      "id": "1221537",
      "postDate": "03/01/2021 04:20:40",
      "content": "<p>I run GroupKFold and found that the data is devided into stratified with \"ETT - Abnormal\" like below.</p>\n<pre><code>fold  ETT - Abnormal\n0     0                 6000\n      1                   17\n1     0                 6001\n      1                   16\n2     0                 5999\n      1                   18\n3     0                 6004\n      1                   12\n4     0                 6000\n      1                   16\ndtype: int64\n</code></pre>\n<p>Is this a coincidence?<br>\nOr by design of GroupKFold?</p>",
      "rawMarkdown": "I run GroupKFold and found that the data is devided into stratified with \"ETT - Abnormal\" like below.\n\n```\nfold  ETT - Abnormal\n0     0                 6000\n      1                   17\n1     0                 6001\n      1                   16\n2     0                 5999\n      1                   18\n3     0                 6004\n      1                   12\n4     0                 6000\n      1                   16\ndtype: int64\n```\n\nIs this a coincidence?\nOr by design of GroupKFold?",
      "votes": null
    },
    {
      "id": "1221768",
      "postDate": "03/01/2021 09:00:38",
      "content": "<p>At least <a href=\"https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GroupKFold.html\" target=\"_blank\">scikit-learn's GroupKFold</a> does not even let you tell it what the target variables are. So, I'd venture to \"guess\" that's chance (and your other targets might of course be less balanced). With <code>skmultilearn</code>'s <code>.model_selection.IterativeStratification</code> you can try to explicitly target balance across your multiple labels in your CV.</p>",
      "rawMarkdown": "At least [scikit-learn's GroupKFold](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GroupKFold.html) does not even let you tell it what the target variables are. So, I'd venture to \"guess\" that's chance (and your other targets might of course be less balanced). With `skmultilearn`'s `.model_selection.IterativeStratification` you can try to explicitly target balance across your multiple labels in your CV.",
      "votes": null
    },
    {
      "id": "1222327",
      "postDate": "03/01/2021 17:50:12",
      "content": "<p>I shared <a href=\"https://www.kaggle.com/virilo/ranzcr-clip-stratified-kfold-to-team-up-v3\" target=\"_blank\">this notebook with a little bit more thank GroupKFold</a></p>\n<p>For five folds, it balances ETT - Abnormal:    16.0    16.0    15.0    16.0    16.0</p>",
      "rawMarkdown": "I shared [this notebook with a little bit more thank GroupKFold](https://www.kaggle.com/virilo/ranzcr-clip-stratified-kfold-to-team-up-v3)\n\nFor five folds, it balances ETT - Abnormal:\t16.0\t16.0\t15.0\t16.0\t16.0",
      "votes": null
    },
    {
      "id": "1222600",
      "postDate": "03/02/2021 00:27:11",
      "content": "<p>I got it! Thank you very much!</p>",
      "rawMarkdown": "I got it! Thank you very much!",
      "votes": null
    },
    {
      "id": "1222601",
      "postDate": "03/02/2021 00:27:33",
      "content": "<p>Thanks! I'll check it!</p>",
      "rawMarkdown": "Thanks! I'll check it!",
      "votes": null
    },
    {
      "id": "1224623",
      "postDate": "03/02/2021 23:03:20",
      "content": "<p>Have a look at this discussion: <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></p>",
      "rawMarkdown": "Have a look at this discussion: https://www.kaggle.com/c/ranzcr-clip-catheter-line-classification/discussion/204638",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1221768,
      "author_name": "bjoernholzhauer",
      "author_url": "",
      "post_date": "03/01/2021 09:00:38",
      "content": "<p>At least <a href=\"https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GroupKFold.html\" target=\"_blank\">scikit-learn's GroupKFold</a> does not even let you tell it what the target variables are. So, I'd venture to \"guess\" that's chance (and your other targets might of course be less balanced). With <code>skmultilearn</code>'s <code>.model_selection.IterativeStratification</code> you can try to explicitly target balance across your multiple labels in your CV.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1222600,
          "author_name": "tt0721",
          "author_url": "",
          "post_date": "03/02/2021 00:27:11",
          "content": "<p>I got it! Thank you very much!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1222327,
      "author_name": "virilo",
      "author_url": "",
      "post_date": "03/01/2021 17:50:12",
      "content": "<p>I shared <a href=\"https://www.kaggle.com/virilo/ranzcr-clip-stratified-kfold-to-team-up-v3\" target=\"_blank\">this notebook with a little bit more thank GroupKFold</a></p>\n<p>For five folds, it balances ETT - Abnormal:    16.0    16.0    15.0    16.0    16.0</p>",
      "votes": null,
      "replies": [
        {
          "id": 1222601,
          "author_name": "tt0721",
          "author_url": "",
          "post_date": "03/02/2021 00:27:33",
          "content": "<p>Thanks! I'll check it!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1224623,
      "author_name": "anjum48",
      "author_url": "",
      "post_date": "03/02/2021 23:03:20",
      "content": "<p>Have a look at this discussion: <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></p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1221537": "I run GroupKFold and found that the data is devided into stratified with \"ETT - Abnormal\" like below.\n\n```\nfold  ETT - Abnormal\n0     0                 6000\n      1                   17\n1     0                 6001\n      1                   16\n2     0                 5999\n      1                   18\n3     0                 6004\n      1                   12\n4     0                 6000\n      1                   16\ndtype: int64\n```\n\nIs this a coincidence?\nOr by design of GroupKFold?",
    "1221768": "At least [scikit-learn's GroupKFold](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GroupKFold.html) does not even let you tell it what the target variables are. So, I'd venture to \"guess\" that's chance (and your other targets might of course be less balanced). With `skmultilearn`'s `.model_selection.IterativeStratification` you can try to explicitly target balance across your multiple labels in your CV.",
    "1222327": "I shared [this notebook with a little bit more thank GroupKFold](https://www.kaggle.com/virilo/ranzcr-clip-stratified-kfold-to-team-up-v3)\n\nFor five folds, it balances ETT - Abnormal:\t16.0\t16.0\t15.0\t16.0\t16.0",
    "1222600": "I got it! Thank you very much!",
    "1222601": "Thanks! I'll check it!",
    "1224623": "Have a look at this discussion: https://www.kaggle.com/c/ranzcr-clip-catheter-line-classification/discussion/204638"
  },
  "source": "meta"
}