{
  "id": 603599,
  "title": "9th place solution",
  "url": "/competitions/cmi-detect-behavior-with-sensor-data/discussion/603599",
  "author_name": "Fnoa",
  "post_date": "2025-09-03T09:35:09.321000",
  "votes": 31,
  "comment_count": 1,
  "views": 0,
  "content": "<h1>9th Place Solution - Child Mind Institute Competition</h1>\n<p>Thank you Kaggle and Child Mind Institute for hosting this fascinating competition! This was an incredible learning experience working with multimodal sensor data for behavioral analysis.</p>\n<h2>Solution Overview</h2>\n<p><strong>Three model types</strong> leveraging different sensor modalities:</p>\n<ul>\n<li><strong>IMU-only</strong>: Inertial measurement data (raw features + engineered)</li>\n<li><strong>THM + IMU</strong>: Thermal (raw + aggregations + calculated) + inertial fusion</li>\n<li><strong>TOF + IMU</strong>: Time-of-flight (aggregations + calculated only, no raw) + inertial fusion</li>\n</ul>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F3147995%2Fe081de9ae18f0e0503e924017f467744%2Faa.png?generation=1756889180134767&amp;alt=media\" alt=\"\"></p>\n<h2>Base Model Architecture</h2>\n<p><strong>Hybrid CNN-RNN Multi-Modal Neural Network:</strong> (similar to public one)</p>\n<ul>\n<li><strong>Feature Extraction</strong>: Residual CNN blocks + SE-attention → spatial feature learning</li>\n<li><strong>Temporal Modeling</strong>: Bidirectional GRU + attention mechanism → complex temporal dependencies</li>\n<li><strong>Multi-Sensor Fusion</strong>: Parallel processing of IMU + thermal + ToF sensor data → classification</li>\n</ul>\n<pre><code> (nn.Module):\n     ():\n        \n        .imu_block1 = ResidualSECNNBlock(.imu_dim, , )\n        .imu_block2 = ResidualSECNNBlock(, .sequence_length, )\n\n        \n        .bigru = nn.GRU(.sequence_length, .sequence_length, \n                           bidirectional=, batch_first=)\n\n        \n        .attention = AttentionLayer(.sequence_length * )\n</code></pre>\n<h2>Key Improvements</h2>\n<h3>1. <strong>Handedness Normalization</strong></h3>\n<ul>\n<li><strong>Issue</strong>: Left vs right-handed subjects create inconsistent patterns</li>\n<li><strong>Fix</strong>: Coordinate system flip (<code>-acc_x, -rot_y, -rot_z</code>)</li>\n</ul>\n<h3>2. <strong>Normalization Strategy</strong></h3>\n<ul>\n<li><strong>No preprocessing normalization</strong> → let model learn optimal scaling</li>\n<li><strong>Batch normalization</strong> throughout network → stable training</li>\n</ul>\n<h3>3. <strong>Target modification</strong></h3>\n<ul>\n<li>I used gesture + orientation target (a total of 51 targets)</li>\n</ul>\n<h3>4. <strong>Feature Engineering Strategy</strong></h3>\n<ul>\n<li><strong>TOF data</strong>: Only fe features (not rawt)</li>\n<li><strong>THM data</strong>: raw + fe features</li>\n<li><strong>IMU data</strong>: raw + fe features (same as public notebooks)</li>\n</ul>\n<h3>5. <strong>Data Augmentation</strong></h3>\n<ul>\n<li>Mixup augmentation for temporal sequences</li>\n<li>Same augmenations than public notebooks</li>\n</ul>\n<h3>6. <strong>Model Ensembling</strong></h3>\n<ul>\n<li>EMA (Exponential Moving Average) for stable predictions (I used ema 0.8, ema 0.9 y normal data for ensembling)</li>\n<li>Each model train with a subset of the total variables, for gaining robustness and diversity</li>\n</ul>\n<h3>7. <strong>Inverse Target Validation Strategy</strong></h3>\n<p>This was a crucial innovation that significantly improved the postprocessing effectiveness:</p>\n<ul>\n<li><strong>Normal Model</strong>: 51 targets where 50 are 0 and 1 is 1 (standard classification)</li>\n<li><strong>Inverse Model</strong>: 51 targets where 50 are 1 and 1 is 0 (inverted classification)</li>\n</ul>\n<p>For each model type (IMU-only, THM+IMU, TOF+IMU), I trained both normal and inverse versions.</p>\n<p><strong>Why this works:</strong> (though I'm not entirely certain)</p>\n<ul>\n<li><strong>Complementary pattern learning</strong>: Captures both positive and negative behavioral indicators</li>\n<li><strong>Enhanced uncertainty representation</strong>: When both models agree → high confidence, when they disagree → uncertainty requiring subject-specific context</li>\n<li><strong>Implicit regularization</strong>: Forces the model to learn consistent representations in both directions</li>\n<li><strong>Better exploitation of multi-class exclusivity</strong>: If something is NOT class A, B, C… it provides information about what it could be</li>\n</ul>\n<h2>The Game Changer: Postprocessing Pipeline</h2>\n<p><strong>Discovery</strong>: 13 days before competition end, I realized that past predictions from the same subject can significantly improve current predictions.</p>\n<h3>Processing Flow</h3>\n<pre><code>  →   →   →     →   →  \n</code></pre>\n<p><strong>Step-by-step Process:</strong></p>\n<ol>\n<li><strong>Sensor Availability Check</strong></li>\n</ol>\n<pre><code>   Available Sensors →  Choice\n   IMU only        → IMU  ( + Inverse)\n   IMU + THM       → THM+IMU  ( + Inverse)\n   IMU + TOF       → TOF+IMU  ( + Inverse)\n</code></pre>\n<ol>\n<li><p><strong>Dual Model Prediction</strong></p>\n<ul>\n<li>Generate predictions using both normal and inverse models</li>\n<li>Apply inverse target validation combining both outputs</li>\n<li>The combination of normal and inverse predictions creates a more robust uncertainty estimate</li></ul></li>\n<li><p><strong>Subject-Aware Postprocessing</strong></p></li>\n</ol>\n<pre><code>   Current   + Historical   → Enhanced Prediction\n</code></pre>\n<ul>\n<li>Leverage temporal consistency within subjects</li>\n<li>Use past predictions to inform current ones</li>\n<li>The inverse model is particularly effective here because it helps identify \"what this specific subject would NOT do\" based on their history</li>\n</ul>\n<h3>Results Impact</h3>\n<table>\n<thead>\n<tr>\n<th>Metric</th>\n<th>No Postprocessing</th>\n<th>With Postprocessing</th>\n<th>Improvement</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><strong>IMU CV</strong></td>\n<td>0.81</td>\n<td>0.84</td>\n<td>+0.03</td>\n</tr>\n<tr>\n<td><strong>ALL CV</strong></td>\n<td>0.84</td>\n<td>0.89</td>\n<td>+0.05</td>\n</tr>\n<tr>\n<td><strong>Public LB</strong></td>\n<td>0.850</td>\n<td>0.882</td>\n<td>+0.032</td>\n</tr>\n<tr>\n<td><strong>Private LB</strong></td>\n<td>0.841</td>\n<td>0.868</td>\n<td>+0.027</td>\n</tr>\n</tbody>\n</table>\n<p><em>CV results based on 1 fold out of 5 for time efficiency</em></p>\n<h3>Model Training Details</h3>\n<ul>\n<li><strong>Sequence length</strong>: Primarily 140, with 160 for final ensemble diversity</li>\n<li><strong>Loss function</strong>: BCEWithLogitsLoss for multi-label classification</li>\n<li><strong>Optimizer</strong>: AdamW with linear learning rate scheduling</li>\n<li><strong>Regularization</strong>: Dropout layers + L2 weight decay</li>\n<li><strong>Final ensemble</strong>: Multiple models trained on complete dataset for maximum performance (both normal and inverse versions)</li>\n<li><strong>Preprocessing variants</strong>: Tested different preprocessing pipelines for robustness (no gains observed)</li>\n</ul>\n<h2>Lessons Learned</h2>\n<ul>\n<li><strong>Late-stage discoveries</strong> can dramatically change competition outcomes</li>\n<li><strong>Inverse modeling approach</strong> can provide complementary information that standard approaches miss</li>\n<li><strong>Luck factor</strong>: I believe I had some luck in discovering the postprocessing method that worked so well, though I'm still not entirely sure why the inverse target approach works as effectively as it does</li>\n</ul>\n<p>Thank you to all participants for the great competition and shared insights!</p>",
  "messages": [
    {
      "id": 3280878,
      "postDate": "2025-09-03T09:35:09.320Z",
      "content": "<h1>9th Place Solution - Child Mind Institute Competition</h1>\n<p>Thank you Kaggle and Child Mind Institute for hosting this fascinating competition! This was an incredible learning experience working with multimodal sensor data for behavioral analysis.</p>\n<h2>Solution Overview</h2>\n<p><strong>Three model types</strong> leveraging different sensor modalities:</p>\n<ul>\n<li><strong>IMU-only</strong>: Inertial measurement data (raw features + engineered)</li>\n<li><strong>THM + IMU</strong>: Thermal (raw + aggregations + calculated) + inertial fusion</li>\n<li><strong>TOF + IMU</strong>: Time-of-flight (aggregations + calculated only, no raw) + inertial fusion</li>\n</ul>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F3147995%2Fe081de9ae18f0e0503e924017f467744%2Faa.png?generation=1756889180134767&amp;alt=media\" alt=\"\"></p>\n<h2>Base Model Architecture</h2>\n<p><strong>Hybrid CNN-RNN Multi-Modal Neural Network:</strong> (similar to public one)</p>\n<ul>\n<li><strong>Feature Extraction</strong>: Residual CNN blocks + SE-attention → spatial feature learning</li>\n<li><strong>Temporal Modeling</strong>: Bidirectional GRU + attention mechanism → complex temporal dependencies</li>\n<li><strong>Multi-Sensor Fusion</strong>: Parallel processing of IMU + thermal + ToF sensor data → classification</li>\n</ul>\n<pre><code> (nn.Module):\n     ():\n        \n        .imu_block1 = ResidualSECNNBlock(.imu_dim, , )\n        .imu_block2 = ResidualSECNNBlock(, .sequence_length, )\n\n        \n        .bigru = nn.GRU(.sequence_length, .sequence_length, \n                           bidirectional=, batch_first=)\n\n        \n        .attention = AttentionLayer(.sequence_length * )\n</code></pre>\n<h2>Key Improvements</h2>\n<h3>1. <strong>Handedness Normalization</strong></h3>\n<ul>\n<li><strong>Issue</strong>: Left vs right-handed subjects create inconsistent patterns</li>\n<li><strong>Fix</strong>: Coordinate system flip (<code>-acc_x, -rot_y, -rot_z</code>)</li>\n</ul>\n<h3>2. <strong>Normalization Strategy</strong></h3>\n<ul>\n<li><strong>No preprocessing normalization</strong> → let model learn optimal scaling</li>\n<li><strong>Batch normalization</strong> throughout network → stable training</li>\n</ul>\n<h3>3. <strong>Target modification</strong></h3>\n<ul>\n<li>I used gesture + orientation target (a total of 51 targets)</li>\n</ul>\n<h3>4. <strong>Feature Engineering Strategy</strong></h3>\n<ul>\n<li><strong>TOF data</strong>: Only fe features (not rawt)</li>\n<li><strong>THM data</strong>: raw + fe features</li>\n<li><strong>IMU data</strong>: raw + fe features (same as public notebooks)</li>\n</ul>\n<h3>5. <strong>Data Augmentation</strong></h3>\n<ul>\n<li>Mixup augmentation for temporal sequences</li>\n<li>Same augmenations than public notebooks</li>\n</ul>\n<h3>6. <strong>Model Ensembling</strong></h3>\n<ul>\n<li>EMA (Exponential Moving Average) for stable predictions (I used ema 0.8, ema 0.9 y normal data for ensembling)</li>\n<li>Each model train with a subset of the total variables, for gaining robustness and diversity</li>\n</ul>\n<h3>7. <strong>Inverse Target Validation Strategy</strong></h3>\n<p>This was a crucial innovation that significantly improved the postprocessing effectiveness:</p>\n<ul>\n<li><strong>Normal Model</strong>: 51 targets where 50 are 0 and 1 is 1 (standard classification)</li>\n<li><strong>Inverse Model</strong>: 51 targets where 50 are 1 and 1 is 0 (inverted classification)</li>\n</ul>\n<p>For each model type (IMU-only, THM+IMU, TOF+IMU), I trained both normal and inverse versions.</p>\n<p><strong>Why this works:</strong> (though I'm not entirely certain)</p>\n<ul>\n<li><strong>Complementary pattern learning</strong>: Captures both positive and negative behavioral indicators</li>\n<li><strong>Enhanced uncertainty representation</strong>: When both models agree → high confidence, when they disagree → uncertainty requiring subject-specific context</li>\n<li><strong>Implicit regularization</strong>: Forces the model to learn consistent representations in both directions</li>\n<li><strong>Better exploitation of multi-class exclusivity</strong>: If something is NOT class A, B, C… it provides information about what it could be</li>\n</ul>\n<h2>The Game Changer: Postprocessing Pipeline</h2>\n<p><strong>Discovery</strong>: 13 days before competition end, I realized that past predictions from the same subject can significantly improve current predictions.</p>\n<h3>Processing Flow</h3>\n<pre><code>  →   →   →     →   →  \n</code></pre>\n<p><strong>Step-by-step Process:</strong></p>\n<ol>\n<li><strong>Sensor Availability Check</strong></li>\n</ol>\n<pre><code>   Available Sensors →  Choice\n   IMU only        → IMU  ( + Inverse)\n   IMU + THM       → THM+IMU  ( + Inverse)\n   IMU + TOF       → TOF+IMU  ( + Inverse)\n</code></pre>\n<ol>\n<li><p><strong>Dual Model Prediction</strong></p>\n<ul>\n<li>Generate predictions using both normal and inverse models</li>\n<li>Apply inverse target validation combining both outputs</li>\n<li>The combination of normal and inverse predictions creates a more robust uncertainty estimate</li></ul></li>\n<li><p><strong>Subject-Aware Postprocessing</strong></p></li>\n</ol>\n<pre><code>   Current   + Historical   → Enhanced Prediction\n</code></pre>\n<ul>\n<li>Leverage temporal consistency within subjects</li>\n<li>Use past predictions to inform current ones</li>\n<li>The inverse model is particularly effective here because it helps identify \"what this specific subject would NOT do\" based on their history</li>\n</ul>\n<h3>Results Impact</h3>\n<table>\n<thead>\n<tr>\n<th>Metric</th>\n<th>No Postprocessing</th>\n<th>With Postprocessing</th>\n<th>Improvement</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><strong>IMU CV</strong></td>\n<td>0.81</td>\n<td>0.84</td>\n<td>+0.03</td>\n</tr>\n<tr>\n<td><strong>ALL CV</strong></td>\n<td>0.84</td>\n<td>0.89</td>\n<td>+0.05</td>\n</tr>\n<tr>\n<td><strong>Public LB</strong></td>\n<td>0.850</td>\n<td>0.882</td>\n<td>+0.032</td>\n</tr>\n<tr>\n<td><strong>Private LB</strong></td>\n<td>0.841</td>\n<td>0.868</td>\n<td>+0.027</td>\n</tr>\n</tbody>\n</table>\n<p><em>CV results based on 1 fold out of 5 for time efficiency</em></p>\n<h3>Model Training Details</h3>\n<ul>\n<li><strong>Sequence length</strong>: Primarily 140, with 160 for final ensemble diversity</li>\n<li><strong>Loss function</strong>: BCEWithLogitsLoss for multi-label classification</li>\n<li><strong>Optimizer</strong>: AdamW with linear learning rate scheduling</li>\n<li><strong>Regularization</strong>: Dropout layers + L2 weight decay</li>\n<li><strong>Final ensemble</strong>: Multiple models trained on complete dataset for maximum performance (both normal and inverse versions)</li>\n<li><strong>Preprocessing variants</strong>: Tested different preprocessing pipelines for robustness (no gains observed)</li>\n</ul>\n<h2>Lessons Learned</h2>\n<ul>\n<li><strong>Late-stage discoveries</strong> can dramatically change competition outcomes</li>\n<li><strong>Inverse modeling approach</strong> can provide complementary information that standard approaches miss</li>\n<li><strong>Luck factor</strong>: I believe I had some luck in discovering the postprocessing method that worked so well, though I'm still not entirely sure why the inverse target approach works as effectively as it does</li>\n</ul>\n<p>Thank you to all participants for the great competition and shared insights!</p>",
      "rawMarkdown": "# 9th Place Solution - Child Mind Institute Competition\n\nThank you Kaggle and Child Mind Institute for hosting this fascinating competition! This was an incredible learning experience working with multimodal sensor data for behavioral analysis.\n\n## Solution Overview\n\n**Three model types** leveraging different sensor modalities:\n- **IMU-only**: Inertial measurement data (raw features + engineered)\n- **THM + IMU**: Thermal (raw + aggregations + calculated) + inertial fusion\n- **TOF + IMU**: Time-of-flight (aggregations + calculated only, no raw) + inertial fusion\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F3147995%2Fe081de9ae18f0e0503e924017f467744%2Faa.png?generation=1756889180134767&alt=media)\n\n## Base Model Architecture\n\n**Hybrid CNN-RNN Multi-Modal Neural Network:** (similar to public one)\n- **Feature Extraction**: Residual CNN blocks + SE-attention → spatial feature learning\n- **Temporal Modeling**: Bidirectional GRU + attention mechanism → complex temporal dependencies\n- **Multi-Sensor Fusion**: Parallel processing of IMU + thermal + ToF sensor data → classification\n\n```python\nclass Net(nn.Module):\n    def __init__(self, cfg):\n        # IMU deep branch\n        self.imu_block1 = ResidualSECNNBlock(self.imu_dim, 64, 3)\n        self.imu_block2 = ResidualSECNNBlock(64, self.sequence_length, 5)\n        \n        # Bidirectional GRU\n        self.bigru = nn.GRU(self.sequence_length, self.sequence_length, \n                           bidirectional=True, batch_first=True)\n        \n        # Attention mechanism\n        self.attention = AttentionLayer(self.sequence_length * 2)\n```\n\n## Key Improvements\n\n### 1. **Handedness Normalization**\n- **Issue**: Left vs right-handed subjects create inconsistent patterns\n- **Fix**: Coordinate system flip (`-acc_x, -rot_y, -rot_z`)\n\n### 2. **Normalization Strategy**\n- **No preprocessing normalization** → let model learn optimal scaling\n- **Batch normalization** throughout network → stable training\n\n### 3. **Target modification**\n- I used gesture + orientation target (a total of 51 targets)\n### 4. **Feature Engineering Strategy**\n- **TOF data**: Only fe features (not rawt)\n- **THM data**: raw + fe features\n- **IMU data**: raw + fe features (same as public notebooks)\n\n### 5. **Data Augmentation**\n- Mixup augmentation for temporal sequences\n-  Same augmenations than public notebooks\n\n### 6. **Model Ensembling**\n- EMA (Exponential Moving Average) for stable predictions (I used ema 0.8, ema 0.9 y normal data for ensembling)\n- Each model train with a subset of the total variables, for gaining robustness and diversity\n\n### 7. **Inverse Target Validation Strategy**\nThis was a crucial innovation that significantly improved the postprocessing effectiveness:\n\n- **Normal Model**: 51 targets where 50 are 0 and 1 is 1 (standard classification)\n- **Inverse Model**: 51 targets where 50 are 1 and 1 is 0 (inverted classification)\n\nFor each model type (IMU-only, THM+IMU, TOF+IMU), I trained both normal and inverse versions.\n\n**Why this works:** (though I'm not entirely certain)\n- **Complementary pattern learning**: Captures both positive and negative behavioral indicators\n- **Enhanced uncertainty representation**: When both models agree → high confidence, when they disagree → uncertainty requiring subject-specific context\n- **Implicit regularization**: Forces the model to learn consistent representations in both directions\n- **Better exploitation of multi-class exclusivity**: If something is NOT class A, B, C... it provides information about what it could be\n\n## The Game Changer: Postprocessing Pipeline\n\n**Discovery**: 13 days before competition end, I realized that past predictions from the same subject can significantly improve current predictions.\n\n### Processing Flow\n\n```\nInput Sequence → Sensor Detection → Model Selection → Normal + Inverse Prediction → Subject History → Final Output\n```\n\n**Step-by-step Process:**\n\n1. **Sensor Availability Check**\n   ```\n   Available Sensors → Model Choice\n   IMU only        → IMU Model (Normal + Inverse)\n   IMU + THM       → THM+IMU Model (Normal + Inverse)\n   IMU + TOF       → TOF+IMU Model (Normal + Inverse)\n   ```\n\n2. **Dual Model Prediction**\n   - Generate predictions using both normal and inverse models\n   - Apply inverse target validation combining both outputs\n   - The combination of normal and inverse predictions creates a more robust uncertainty estimate\n\n3. **Subject-Aware Postprocessing**\n   ```\n   Current Prediction (Normal + Inverse) + Historical Sequences (same subject) → Enhanced Prediction\n   ```\n   - Leverage temporal consistency within subjects\n   - Use past predictions to inform current ones\n   - The inverse model is particularly effective here because it helps identify \"what this specific subject would NOT do\" based on their history\n\n### Results Impact\n\n| Metric | No Postprocessing | With Postprocessing | Improvement |\n|--------|------------------|-------------------|-------------|\n| **IMU CV** | 0.81 | 0.84 | +0.03 |\n| **ALL CV** | 0.84 | 0.89 | +0.05 |\n| **Public LB** | 0.850 | 0.882 | +0.032 |\n| **Private LB** | 0.841 | 0.868 | +0.027 |\n\n*CV results based on 1 fold out of 5 for time efficiency*\n\n\n### Model Training Details\n- **Sequence length**: Primarily 140, with 160 for final ensemble diversity\n- **Loss function**: BCEWithLogitsLoss for multi-label classification\n- **Optimizer**: AdamW with linear learning rate scheduling\n- **Regularization**: Dropout layers + L2 weight decay\n- **Final ensemble**: Multiple models trained on complete dataset for maximum performance (both normal and inverse versions)\n- **Preprocessing variants**: Tested different preprocessing pipelines for robustness (no gains observed)\n\n## Lessons Learned\n\n- **Late-stage discoveries** can dramatically change competition outcomes\n- **Inverse modeling approach** can provide complementary information that standard approaches miss\n- **Luck factor**: I believe I had some luck in discovering the postprocessing method that worked so well, though I'm still not entirely sure why the inverse target approach works as effectively as it does\n\nThank you to all participants for the great competition and shared insights!",
      "votes": 31
    },
    {
      "id": 3281198,
      "postDate": "2025-09-03T19:41:49.577Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 3281198,
      "author_name": "",
      "author_url": "",
      "post_date": "2025-09-03T19:41:49.577000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "3280878": "# 9th Place Solution - Child Mind Institute Competition\n\nThank you Kaggle and Child Mind Institute for hosting this fascinating competition! This was an incredible learning experience working with multimodal sensor data for behavioral analysis.\n\n## Solution Overview\n\n**Three model types** leveraging different sensor modalities:\n- **IMU-only**: Inertial measurement data (raw features + engineered)\n- **THM + IMU**: Thermal (raw + aggregations + calculated) + inertial fusion\n- **TOF + IMU**: Time-of-flight (aggregations + calculated only, no raw) + inertial fusion\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F3147995%2Fe081de9ae18f0e0503e924017f467744%2Faa.png?generation=1756889180134767&alt=media)\n\n## Base Model Architecture\n\n**Hybrid CNN-RNN Multi-Modal Neural Network:** (similar to public one)\n- **Feature Extraction**: Residual CNN blocks + SE-attention → spatial feature learning\n- **Temporal Modeling**: Bidirectional GRU + attention mechanism → complex temporal dependencies\n- **Multi-Sensor Fusion**: Parallel processing of IMU + thermal + ToF sensor data → classification\n\n```python\nclass Net(nn.Module):\n    def __init__(self, cfg):\n        # IMU deep branch\n        self.imu_block1 = ResidualSECNNBlock(self.imu_dim, 64, 3)\n        self.imu_block2 = ResidualSECNNBlock(64, self.sequence_length, 5)\n        \n        # Bidirectional GRU\n        self.bigru = nn.GRU(self.sequence_length, self.sequence_length, \n                           bidirectional=True, batch_first=True)\n        \n        # Attention mechanism\n        self.attention = AttentionLayer(self.sequence_length * 2)\n```\n\n## Key Improvements\n\n### 1. **Handedness Normalization**\n- **Issue**: Left vs right-handed subjects create inconsistent patterns\n- **Fix**: Coordinate system flip (`-acc_x, -rot_y, -rot_z`)\n\n### 2. **Normalization Strategy**\n- **No preprocessing normalization** → let model learn optimal scaling\n- **Batch normalization** throughout network → stable training\n\n### 3. **Target modification**\n- I used gesture + orientation target (a total of 51 targets)\n### 4. **Feature Engineering Strategy**\n- **TOF data**: Only fe features (not rawt)\n- **THM data**: raw + fe features\n- **IMU data**: raw + fe features (same as public notebooks)\n\n### 5. **Data Augmentation**\n- Mixup augmentation for temporal sequences\n-  Same augmenations than public notebooks\n\n### 6. **Model Ensembling**\n- EMA (Exponential Moving Average) for stable predictions (I used ema 0.8, ema 0.9 y normal data for ensembling)\n- Each model train with a subset of the total variables, for gaining robustness and diversity\n\n### 7. **Inverse Target Validation Strategy**\nThis was a crucial innovation that significantly improved the postprocessing effectiveness:\n\n- **Normal Model**: 51 targets where 50 are 0 and 1 is 1 (standard classification)\n- **Inverse Model**: 51 targets where 50 are 1 and 1 is 0 (inverted classification)\n\nFor each model type (IMU-only, THM+IMU, TOF+IMU), I trained both normal and inverse versions.\n\n**Why this works:** (though I'm not entirely certain)\n- **Complementary pattern learning**: Captures both positive and negative behavioral indicators\n- **Enhanced uncertainty representation**: When both models agree → high confidence, when they disagree → uncertainty requiring subject-specific context\n- **Implicit regularization**: Forces the model to learn consistent representations in both directions\n- **Better exploitation of multi-class exclusivity**: If something is NOT class A, B, C... it provides information about what it could be\n\n## The Game Changer: Postprocessing Pipeline\n\n**Discovery**: 13 days before competition end, I realized that past predictions from the same subject can significantly improve current predictions.\n\n### Processing Flow\n\n```\nInput Sequence → Sensor Detection → Model Selection → Normal + Inverse Prediction → Subject History → Final Output\n```\n\n**Step-by-step Process:**\n\n1. **Sensor Availability Check**\n   ```\n   Available Sensors → Model Choice\n   IMU only        → IMU Model (Normal + Inverse)\n   IMU + THM       → THM+IMU Model (Normal + Inverse)\n   IMU + TOF       → TOF+IMU Model (Normal + Inverse)\n   ```\n\n2. **Dual Model Prediction**\n   - Generate predictions using both normal and inverse models\n   - Apply inverse target validation combining both outputs\n   - The combination of normal and inverse predictions creates a more robust uncertainty estimate\n\n3. **Subject-Aware Postprocessing**\n   ```\n   Current Prediction (Normal + Inverse) + Historical Sequences (same subject) → Enhanced Prediction\n   ```\n   - Leverage temporal consistency within subjects\n   - Use past predictions to inform current ones\n   - The inverse model is particularly effective here because it helps identify \"what this specific subject would NOT do\" based on their history\n\n### Results Impact\n\n| Metric | No Postprocessing | With Postprocessing | Improvement |\n|--------|------------------|-------------------|-------------|\n| **IMU CV** | 0.81 | 0.84 | +0.03 |\n| **ALL CV** | 0.84 | 0.89 | +0.05 |\n| **Public LB** | 0.850 | 0.882 | +0.032 |\n| **Private LB** | 0.841 | 0.868 | +0.027 |\n\n*CV results based on 1 fold out of 5 for time efficiency*\n\n\n### Model Training Details\n- **Sequence length**: Primarily 140, with 160 for final ensemble diversity\n- **Loss function**: BCEWithLogitsLoss for multi-label classification\n- **Optimizer**: AdamW with linear learning rate scheduling\n- **Regularization**: Dropout layers + L2 weight decay\n- **Final ensemble**: Multiple models trained on complete dataset for maximum performance (both normal and inverse versions)\n- **Preprocessing variants**: Tested different preprocessing pipelines for robustness (no gains observed)\n\n## Lessons Learned\n\n- **Late-stage discoveries** can dramatically change competition outcomes\n- **Inverse modeling approach** can provide complementary information that standard approaches miss\n- **Luck factor**: I believe I had some luck in discovering the postprocessing method that worked so well, though I'm still not entirely sure why the inverse target approach works as effectively as it does\n\nThank you to all participants for the great competition and shared insights!",
    "3281198": ""
  }
}