{
  "id": 605449,
  "title": "14th Place Solution ",
  "url": "/competitions/cmi-detect-behavior-with-sensor-data/writeups/14th-place-solution",
  "author_name": "",
  "post_date": "2025-09-08T10:49:55.557Z",
  "votes": 14,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Many thanks to the organizers—this challenge offered a rich playground of modeling ideas and yielded plenty of hard-won lessons</p>\n<p><strong>TL;DR</strong><br>\nI used subject-wise GroupStratifiedKFold CV (5 folds for analysis; 20-fold bagging for the final submission), careful handedness normalization (mirror left→right), and 180° correction for two reversed-worn subjects. The modeling stack combined WaveNet, ResNet, U-Net, and SqueezeFormer on 96-step sequences, trained with sample weights, time-series augmentations, and EMA weight smoothing. Because some sequences lacked rotation (quat) features, I trained four model variants (IMU-only vs IMU+THM+ToF; with/without accel-only). At inference, I gated examples to the appropriate variant when rotation features were missing. This gating yielded a +0.0015 improvement on the Private LB, which kept me in the gold zone.</p>\n<p><strong>Pre-processing &amp; normalization</strong></p>\n<ul>\n<li><strong>Handedness normalization</strong>: mirrored <strong>left-hand</strong> recordings to **right-hand ** coordinates to unify kinematics.</li>\n<li><strong>Reversed-wear correction</strong>: two subjects wore the device reversed; I applied a <strong>180°</strong> rotation to bring their frames in line.</li>\n<li><strong>Sequence windowing</strong>: fixed <strong>sequence length = 96</strong> samples per example.</li>\n<li><strong>Missing rotation features</strong> : some sequences lacked quaternions/derived rotation features (Na). This motivated the model variants below and the inference router.</li>\n</ul>\n<p><strong>Cross-validation</strong></p>\n<ul>\n<li><p><strong>CV scheme:</strong>  GroupStratifiedKFold by subject to preserve class proportions while preventing subject leakage.</p></li>\n<li><p><strong>Folds:</strong> I ran experiments with 5 folds (reporting CV), then built the final ensemble via 20-fold bagging (diverse splits/seeds under the same subject-grouped principle).</p></li>\n<li><p><strong>Why this matters:</strong> subjects have distinct motion signatures; mixing a subject across train/valid inflates CV. Grouped CV produced stable CV↔LB alignment and reduced overfitting risk.</p></li>\n<li><p><strong>Features</strong><br>\nI combined competitive public feature ideas with additional temporal/physical descriptors:</p></li>\n<li><p>Public baseline features (adopted and pruned from community notebooks)</p></li>\n<li><p>Temporal gradients</p></li>\n<li><p>Absolute values</p></li>\n<li><p>Quaternion-derived features</p></li>\n</ul>\n<p><strong>Model family (multi-architecture ensemble)</strong><br>\nAll models consumed <strong>96-step sequences</strong> with identical train/valid splits.</p>\n<ul>\n<li>WaveNet</li>\n<li>ResNet</li>\n<li>U-Net</li>\n<li>SqueezeFormer</li>\n</ul>\n<p>Four training variants (to handle missing rotations)</p>\n<ol>\n<li>IMU-only (all IMU features).</li>\n<li>IMU-only (accelerometer features only).</li>\n<li>IMU + THM + ToF (all IMU features).</li>\n<li>IMU(acc-only) + THM + ToF.</li>\n</ol>\n<p><strong>Inference routing:</strong> when rotation/quat-derived features were missing, I used <strong>(2) or (4)</strong> accordingly. Otherwise <strong>(1) or (3).</strong> This simple gate materially improved final reliability on mixed-modality test data.</p>\n<p><strong>Training details</strong></p>\n<ul>\n<li><strong>Loss &amp; weighting:</strong> class imbalance addressed via sample weights</li>\n<li><strong>Augmentation (time series):</strong> light jitter, time-shift, and scale perturbations; mirror/rotation ops conformed to physically plausible transforms.</li>\n<li><strong>EMA weight smoothing:</strong> maintained an Exponential Moving Average of model parameters; EMA weights used for validation/inference to stabilize loss.</li>\n</ul>\n<p>Many thanks to the competition organizers and the Kaggle community for resources and discussions</p>",
  "messages": [
    {
      "id": "3284515",
      "postDate": "09/08/2025 10:45:33",
      "content": "<p>Many thanks to the organizers—this challenge offered a rich playground of modeling ideas and yielded plenty of hard-won lessons</p>\n<p><strong>TL;DR</strong><br>\nI used subject-wise GroupStratifiedKFold CV (5 folds for analysis; 20-fold bagging for the final submission), careful handedness normalization (mirror left→right), and 180° correction for two reversed-worn subjects. The modeling stack combined WaveNet, ResNet, U-Net, and SqueezeFormer on 96-step sequences, trained with sample weights, time-series augmentations, and EMA weight smoothing. Because some sequences lacked rotation (quat) features, I trained four model variants (IMU-only vs IMU+THM+ToF; with/without accel-only). At inference, I gated examples to the appropriate variant when rotation features were missing. This gating yielded a +0.0015 improvement on the Private LB, which kept me in the gold zone.</p>\n<p><strong>Pre-processing &amp; normalization</strong></p>\n<ul>\n<li><strong>Handedness normalization</strong>: mirrored <strong>left-hand</strong> recordings to **right-hand ** coordinates to unify kinematics.</li>\n<li><strong>Reversed-wear correction</strong>: two subjects wore the device reversed; I applied a <strong>180°</strong> rotation to bring their frames in line.</li>\n<li><strong>Sequence windowing</strong>: fixed <strong>sequence length = 96</strong> samples per example.</li>\n<li><strong>Missing rotation features</strong> : some sequences lacked quaternions/derived rotation features (Na). This motivated the model variants below and the inference router.</li>\n</ul>\n<p><strong>Cross-validation</strong></p>\n<ul>\n<li><p><strong>CV scheme:</strong>  GroupStratifiedKFold by subject to preserve class proportions while preventing subject leakage.</p></li>\n<li><p><strong>Folds:</strong> I ran experiments with 5 folds (reporting CV), then built the final ensemble via 20-fold bagging (diverse splits/seeds under the same subject-grouped principle).</p></li>\n<li><p><strong>Why this matters:</strong> subjects have distinct motion signatures; mixing a subject across train/valid inflates CV. Grouped CV produced stable CV↔LB alignment and reduced overfitting risk.</p></li>\n<li><p><strong>Features</strong><br>\nI combined competitive public feature ideas with additional temporal/physical descriptors:</p></li>\n<li><p>Public baseline features (adopted and pruned from community notebooks)</p></li>\n<li><p>Temporal gradients</p></li>\n<li><p>Absolute values</p></li>\n<li><p>Quaternion-derived features</p></li>\n</ul>\n<p><strong>Model family (multi-architecture ensemble)</strong><br>\nAll models consumed <strong>96-step sequences</strong> with identical train/valid splits.</p>\n<ul>\n<li>WaveNet</li>\n<li>ResNet</li>\n<li>U-Net</li>\n<li>SqueezeFormer</li>\n</ul>\n<p>Four training variants (to handle missing rotations)</p>\n<ol>\n<li>IMU-only (all IMU features).</li>\n<li>IMU-only (accelerometer features only).</li>\n<li>IMU + THM + ToF (all IMU features).</li>\n<li>IMU(acc-only) + THM + ToF.</li>\n</ol>\n<p><strong>Inference routing:</strong> when rotation/quat-derived features were missing, I used <strong>(2) or (4)</strong> accordingly. Otherwise <strong>(1) or (3).</strong> This simple gate materially improved final reliability on mixed-modality test data.</p>\n<p><strong>Training details</strong></p>\n<ul>\n<li><strong>Loss &amp; weighting:</strong> class imbalance addressed via sample weights</li>\n<li><strong>Augmentation (time series):</strong> light jitter, time-shift, and scale perturbations; mirror/rotation ops conformed to physically plausible transforms.</li>\n<li><strong>EMA weight smoothing:</strong> maintained an Exponential Moving Average of model parameters; EMA weights used for validation/inference to stabilize loss.</li>\n</ul>\n<p>Many thanks to the competition organizers and the Kaggle community for resources and discussions</p>",
      "rawMarkdown": "Many thanks to the organizers—this challenge offered a rich playground of modeling ideas and yielded plenty of hard-won lessons\n\n**TL;DR**\nI used subject-wise GroupStratifiedKFold CV (5 folds for analysis; 20-fold bagging for the final submission), careful handedness normalization (mirror left→right), and 180° correction for two reversed-worn subjects. The modeling stack combined WaveNet, ResNet, U-Net, and SqueezeFormer on 96-step sequences, trained with sample weights, time-series augmentations, and EMA weight smoothing. Because some sequences lacked rotation (quat) features, I trained four model variants (IMU-only vs IMU+THM+ToF; with/without accel-only). At inference, I gated examples to the appropriate variant when rotation features were missing. This gating yielded a +0.0015 improvement on the Private LB, which kept me in the gold zone.\n\n**Pre-processing & normalization**\n- **Handedness normalization**: mirrored **left-hand** recordings to **right-hand ** coordinates to unify kinematics.\n- **Reversed-wear correction**: two subjects wore the device reversed; I applied a **180°** rotation to bring their frames in line.\n- **Sequence windowing**: fixed **sequence length = 96** samples per example.\n- **Missing rotation features** : some sequences lacked quaternions/derived rotation features (Na). This motivated the model variants below and the inference router.\n\n\n**Cross-validation**\n- **CV scheme:**  GroupStratifiedKFold by subject to preserve class proportions while preventing subject leakage.\n- **Folds:** I ran experiments with 5 folds (reporting CV), then built the final ensemble via 20-fold bagging (diverse splits/seeds under the same subject-grouped principle).\n- **Why this matters:** subjects have distinct motion signatures; mixing a subject across train/valid inflates CV. Grouped CV produced stable CV↔LB alignment and reduced overfitting risk.\n\n- \n**Features**\nI combined competitive public feature ideas with additional temporal/physical descriptors:\n- Public baseline features (adopted and pruned from community notebooks)\n- Temporal gradients\n- Absolute values\n- Quaternion-derived features\n\n\n**Model family (multi-architecture ensemble)**\nAll models consumed **96-step sequences** with identical train/valid splits.\n- WaveNet\n- ResNet\n- U-Net\n- SqueezeFormer\n\n\nFour training variants (to handle missing rotations)\n1. IMU-only (all IMU features).\n2. IMU-only (accelerometer features only).\n3. IMU + THM + ToF (all IMU features).\n4. IMU(acc-only) + THM + ToF.\n\n**Inference routing:** when rotation/quat-derived features were missing, I used **(2) or (4)** accordingly. Otherwise **(1) or (3).** This simple gate materially improved final reliability on mixed-modality test data.\n\n\n**Training details**\n- **Loss & weighting:** class imbalance addressed via sample weights\n- **Augmentation (time series):** light jitter, time-shift, and scale perturbations; mirror/rotation ops conformed to physically plausible transforms.\n- **EMA weight smoothing:** maintained an Exponential Moving Average of model parameters; EMA weights used for validation/inference to stabilize loss.\n\n\nMany thanks to the competition organizers and the Kaggle community for resources and discussions",
      "votes": null
    },
    {
      "id": "3286073",
      "postDate": "09/09/2025 07:52:48",
      "content": "<p>Congrats on solo gold and well deserved grandmaster rank =)</p>",
      "rawMarkdown": "Congrats on solo gold and well deserved grandmaster rank =)",
      "votes": null
    },
    {
      "id": "3286081",
      "postDate": "09/09/2025 08:03:39",
      "content": "<p>Thank you <a href=\"https://www.kaggle.com/datafan07\" target=\"_blank\">@datafan07</a> :) </p>",
      "rawMarkdown": "Thank you @datafan07 :)",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 3286073,
      "author_name": "datafan07",
      "author_url": "",
      "post_date": "09/09/2025 07:52:48",
      "content": "<p>Congrats on solo gold and well deserved grandmaster rank =)</p>",
      "votes": null,
      "replies": [
        {
          "id": 3286081,
          "author_name": "davutpolat",
          "author_url": "",
          "post_date": "09/09/2025 08:03:39",
          "content": "<p>Thank you <a href=\"https://www.kaggle.com/datafan07\" target=\"_blank\">@datafan07</a> :) </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "3284515": "Many thanks to the organizers—this challenge offered a rich playground of modeling ideas and yielded plenty of hard-won lessons\n\n**TL;DR**\nI used subject-wise GroupStratifiedKFold CV (5 folds for analysis; 20-fold bagging for the final submission), careful handedness normalization (mirror left→right), and 180° correction for two reversed-worn subjects. The modeling stack combined WaveNet, ResNet, U-Net, and SqueezeFormer on 96-step sequences, trained with sample weights, time-series augmentations, and EMA weight smoothing. Because some sequences lacked rotation (quat) features, I trained four model variants (IMU-only vs IMU+THM+ToF; with/without accel-only). At inference, I gated examples to the appropriate variant when rotation features were missing. This gating yielded a +0.0015 improvement on the Private LB, which kept me in the gold zone.\n\n**Pre-processing & normalization**\n- **Handedness normalization**: mirrored **left-hand** recordings to **right-hand ** coordinates to unify kinematics.\n- **Reversed-wear correction**: two subjects wore the device reversed; I applied a **180°** rotation to bring their frames in line.\n- **Sequence windowing**: fixed **sequence length = 96** samples per example.\n- **Missing rotation features** : some sequences lacked quaternions/derived rotation features (Na). This motivated the model variants below and the inference router.\n\n\n**Cross-validation**\n- **CV scheme:**  GroupStratifiedKFold by subject to preserve class proportions while preventing subject leakage.\n- **Folds:** I ran experiments with 5 folds (reporting CV), then built the final ensemble via 20-fold bagging (diverse splits/seeds under the same subject-grouped principle).\n- **Why this matters:** subjects have distinct motion signatures; mixing a subject across train/valid inflates CV. Grouped CV produced stable CV↔LB alignment and reduced overfitting risk.\n\n- \n**Features**\nI combined competitive public feature ideas with additional temporal/physical descriptors:\n- Public baseline features (adopted and pruned from community notebooks)\n- Temporal gradients\n- Absolute values\n- Quaternion-derived features\n\n\n**Model family (multi-architecture ensemble)**\nAll models consumed **96-step sequences** with identical train/valid splits.\n- WaveNet\n- ResNet\n- U-Net\n- SqueezeFormer\n\n\nFour training variants (to handle missing rotations)\n1. IMU-only (all IMU features).\n2. IMU-only (accelerometer features only).\n3. IMU + THM + ToF (all IMU features).\n4. IMU(acc-only) + THM + ToF.\n\n**Inference routing:** when rotation/quat-derived features were missing, I used **(2) or (4)** accordingly. Otherwise **(1) or (3).** This simple gate materially improved final reliability on mixed-modality test data.\n\n\n**Training details**\n- **Loss & weighting:** class imbalance addressed via sample weights\n- **Augmentation (time series):** light jitter, time-shift, and scale perturbations; mirror/rotation ops conformed to physically plausible transforms.\n- **EMA weight smoothing:** maintained an Exponential Moving Average of model parameters; EMA weights used for validation/inference to stabilize loss.\n\n\nMany thanks to the competition organizers and the Kaggle community for resources and discussions",
    "3286073": "Congrats on solo gold and well deserved grandmaster rank =)",
    "3286081": "Thank you @datafan07 :)"
  },
  "source": "meta"
}