{
  "id": 590385,
  "title": "Optimal Number of Folds",
  "url": "/competitions/cmi-detect-behavior-with-sensor-data/discussion/590385",
  "author_name": "",
  "post_date": "2025-07-20T10:45:32.441620500Z",
  "votes": 4,
  "comment_count": 4,
  "views": 0,
  "content": "<p>What do you think is the optimal number of folds?<br>\nIn my experiments, the CV score improves as the number of folds increases, but the LB score seems to be best with 10 folds.</p>\n<table>\n<thead>\n<tr>\n<th>n_folds</th>\n<th>CV</th>\n<th>LB</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>5</td>\n<td>0.7747</td>\n<td>0.80</td>\n</tr>\n<tr>\n<td>10</td>\n<td>0.7779</td>\n<td>0.81</td>\n</tr>\n<tr>\n<td>20</td>\n<td>0.7786</td>\n<td>0.80</td>\n</tr>\n<tr>\n<td>25</td>\n<td>0.7817</td>\n<td>0.80</td>\n</tr>\n</tbody>\n</table>",
  "messages": [
    {
      "id": "3251281",
      "postDate": "07/20/2025 10:45:32",
      "content": "<p>What do you think is the optimal number of folds?<br>\nIn my experiments, the CV score improves as the number of folds increases, but the LB score seems to be best with 10 folds.</p>\n<table>\n<thead>\n<tr>\n<th>n_folds</th>\n<th>CV</th>\n<th>LB</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>5</td>\n<td>0.7747</td>\n<td>0.80</td>\n</tr>\n<tr>\n<td>10</td>\n<td>0.7779</td>\n<td>0.81</td>\n</tr>\n<tr>\n<td>20</td>\n<td>0.7786</td>\n<td>0.80</td>\n</tr>\n<tr>\n<td>25</td>\n<td>0.7817</td>\n<td>0.80</td>\n</tr>\n</tbody>\n</table>",
      "rawMarkdown": "What do you think is the optimal number of folds?\nIn my experiments, the CV score improves as the number of folds increases, but the LB score seems to be best with 10 folds.\n\n| n_folds | CV | LB |\n| --- | --- | --- |\n| 5 | 0.7747 | 0.80 |\n| 10 | 0.7779 | 0.81 |\n| 20 | 0.7786 | 0.80 |\n| 25 | 0.7817 | 0.80 |",
      "votes": null
    },
    {
      "id": "3251336",
      "postDate": "07/20/2025 14:04:35",
      "content": "<p>CV 0.7778 LB 0.80</p>\n<p>I think we implemented the same strategy, but I haven't tested 10-fold yet. Let's see!</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F23276411%2Fc30f2fb9ec7900478565d1823936edc2%2FScreenshot%20from%202025-07-20%2019-32-30.png?generation=1753020162029579&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "CV 0.7778 LB 0.80\n\nI think we implemented the same strategy, but I haven't tested 10-fold yet. Let's see!\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F23276411%2Fc30f2fb9ec7900478565d1823936edc2%2FScreenshot%20from%202025-07-20%2019-32-30.png?generation=1753020162029579&alt=media)",
      "votes": null
    },
    {
      "id": "3251608",
      "postDate": "07/21/2025 07:36:53",
      "content": "<p>Thanks for sharing!<br>\nSince the amount of data is small this time, I believe we need to be careful about overfitting, or we might get caught in a shake-up.<br>\nI’ll try to stay focused without being misled by the LB score.</p>",
      "rawMarkdown": "Thanks for sharing!\nSince the amount of data is small this time, I believe we need to be careful about overfitting, or we might get caught in a shake-up.\nI’ll try to stay focused without being misled by the LB score.",
      "votes": null
    },
    {
      "id": "3251879",
      "postDate": "07/21/2025 17:57:09",
      "content": "<p>what is cv and what is it about</p>",
      "rawMarkdown": "what is cv and what is it about",
      "votes": null
    },
    {
      "id": "3251892",
      "postDate": "07/21/2025 18:23:02",
      "content": "<p>In machine learning (ML), CV usually stands for cross-validation — a technique used to evaluate the performance and generalization ability of a machine learning model. Cross-validation (CV) is a resampling procedure used to assess how well a model will perform on unseen data. It helps detect overfitting and underfitting by testing the model on different subsets of the data. Common Types of Cross-Validation</p>\n<ul>\n<li><p>K-Fold Cross-Validation: The dataset is split into K equal parts (folds). The model is trained on K-1 folds and tested on the remaining fold. This process is repeated K times, with each fold used as the test set once. Final performance is the average of all K runs.</p></li>\n<li><p>Stratified K-Fold CV: Like K-Fold but maintains the class distribution in each fold (useful in classification tasks).</p></li>\n<li><p>Leave-One-Out CV (LOOCV): Each data point is used once as a test set, and the rest as the training set. Very accurate but computationally expensive.</p></li>\n<li><p>Time Series CV (Rolling or Expanding Window): Special cross-validation for time-series data, preserving the order of time.</p></li>\n</ul>",
      "rawMarkdown": "In machine learning (ML), CV usually stands for cross-validation — a technique used to evaluate the performance and generalization ability of a machine learning model. Cross-validation (CV) is a resampling procedure used to assess how well a model will perform on unseen data. It helps detect overfitting and underfitting by testing the model on different subsets of the data. Common Types of Cross-Validation\n- K-Fold Cross-Validation: The dataset is split into K equal parts (folds). The model is trained on K-1 folds and tested on the remaining fold. This process is repeated K times, with each fold used as the test set once. Final performance is the average of all K runs.\n\n- Stratified K-Fold CV: Like K-Fold but maintains the class distribution in each fold (useful in classification tasks).\n\n- Leave-One-Out CV (LOOCV): Each data point is used once as a test set, and the rest as the training set. Very accurate but computationally expensive.\n\n- Time Series CV (Rolling or Expanding Window): Special cross-validation for time-series data, preserving the order of time.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 3251336,
      "author_name": "sangrampatil5150",
      "author_url": "",
      "post_date": "07/20/2025 14:04:35",
      "content": "<p>CV 0.7778 LB 0.80</p>\n<p>I think we implemented the same strategy, but I haven't tested 10-fold yet. Let's see!</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F23276411%2Fc30f2fb9ec7900478565d1823936edc2%2FScreenshot%20from%202025-07-20%2019-32-30.png?generation=1753020162029579&amp;alt=media\" alt=\"\"></p>",
      "votes": null,
      "replies": [
        {
          "id": 3251608,
          "author_name": "dsohonosom",
          "author_url": "",
          "post_date": "07/21/2025 07:36:53",
          "content": "<p>Thanks for sharing!<br>\nSince the amount of data is small this time, I believe we need to be careful about overfitting, or we might get caught in a shake-up.<br>\nI’ll try to stay focused without being misled by the LB score.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 3251879,
      "author_name": "kritikapawar511",
      "author_url": "",
      "post_date": "07/21/2025 17:57:09",
      "content": "<p>what is cv and what is it about</p>",
      "votes": null,
      "replies": [
        {
          "id": 3251892,
          "author_name": "yuemingl",
          "author_url": "",
          "post_date": "07/21/2025 18:23:02",
          "content": "<p>In machine learning (ML), CV usually stands for cross-validation — a technique used to evaluate the performance and generalization ability of a machine learning model. Cross-validation (CV) is a resampling procedure used to assess how well a model will perform on unseen data. It helps detect overfitting and underfitting by testing the model on different subsets of the data. Common Types of Cross-Validation</p>\n<ul>\n<li><p>K-Fold Cross-Validation: The dataset is split into K equal parts (folds). The model is trained on K-1 folds and tested on the remaining fold. This process is repeated K times, with each fold used as the test set once. Final performance is the average of all K runs.</p></li>\n<li><p>Stratified K-Fold CV: Like K-Fold but maintains the class distribution in each fold (useful in classification tasks).</p></li>\n<li><p>Leave-One-Out CV (LOOCV): Each data point is used once as a test set, and the rest as the training set. Very accurate but computationally expensive.</p></li>\n<li><p>Time Series CV (Rolling or Expanding Window): Special cross-validation for time-series data, preserving the order of time.</p></li>\n</ul>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "3251281": "What do you think is the optimal number of folds?\nIn my experiments, the CV score improves as the number of folds increases, but the LB score seems to be best with 10 folds.\n\n| n_folds | CV | LB |\n| --- | --- | --- |\n| 5 | 0.7747 | 0.80 |\n| 10 | 0.7779 | 0.81 |\n| 20 | 0.7786 | 0.80 |\n| 25 | 0.7817 | 0.80 |",
    "3251336": "CV 0.7778 LB 0.80\n\nI think we implemented the same strategy, but I haven't tested 10-fold yet. Let's see!\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F23276411%2Fc30f2fb9ec7900478565d1823936edc2%2FScreenshot%20from%202025-07-20%2019-32-30.png?generation=1753020162029579&alt=media)",
    "3251608": "Thanks for sharing!\nSince the amount of data is small this time, I believe we need to be careful about overfitting, or we might get caught in a shake-up.\nI’ll try to stay focused without being misled by the LB score.",
    "3251879": "what is cv and what is it about",
    "3251892": "In machine learning (ML), CV usually stands for cross-validation — a technique used to evaluate the performance and generalization ability of a machine learning model. Cross-validation (CV) is a resampling procedure used to assess how well a model will perform on unseen data. It helps detect overfitting and underfitting by testing the model on different subsets of the data. Common Types of Cross-Validation\n- K-Fold Cross-Validation: The dataset is split into K equal parts (folds). The model is trained on K-1 folds and tested on the remaining fold. This process is repeated K times, with each fold used as the test set once. Final performance is the average of all K runs.\n\n- Stratified K-Fold CV: Like K-Fold but maintains the class distribution in each fold (useful in classification tasks).\n\n- Leave-One-Out CV (LOOCV): Each data point is used once as a test set, and the rest as the training set. Very accurate but computationally expensive.\n\n- Time Series CV (Rolling or Expanding Window): Special cross-validation for time-series data, preserving the order of time."
  },
  "source": "meta"
}