{
  "id": 599983,
  "title": "Spatial Feature from THM, TOF ",
  "url": "/competitions/cmi-detect-behavior-with-sensor-data/discussion/599983",
  "author_name": "Peter",
  "post_date": "2025-08-20T08:12:28.769000",
  "votes": 5,
  "comment_count": 0,
  "views": 0,
  "content": "<h2>THM Feature</h2>\n<p>First of all, We use 5 raw data, and 3 stats data.</p>\n<table>\n<thead>\n<tr>\n<th>Feature Name</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><strong>thm_1</strong></td>\n<td>Raw thermopile measurement (Channel 1)</td>\n</tr>\n<tr>\n<td><strong>thm_2</strong></td>\n<td>Raw thermopile measurement (Channel 2)</td>\n</tr>\n<tr>\n<td><strong>thm_3</strong></td>\n<td>Raw thermopile measurement (Channel 3)</td>\n</tr>\n<tr>\n<td><strong>thm_4</strong></td>\n<td>Raw thermopile measurement (Channel 4)</td>\n</tr>\n<tr>\n<td><strong>thm_5</strong></td>\n<td>Raw thermopile measurement (Channel 5)</td>\n</tr>\n<tr>\n<td><strong>thm_mean</strong></td>\n<td>Statistical feature — mean value across thermopile channels</td>\n</tr>\n<tr>\n<td><strong>thm_std</strong></td>\n<td>Statistical feature — standard deviation across thermopile channels</td>\n</tr>\n<tr>\n<td><strong>thm_range</strong></td>\n<td>Statistical feature — dynamic range (max–min) across thermopile channels</td>\n</tr>\n</tbody>\n</table>\n<hr>\n<p>We further derived <strong>spatial chain features</strong> to capture relative thermal variations across the sensor array. Specifically, four chain descriptors were constructed: <em>right chain</em>, <em>left chain</em>, <em>center chain</em>, and <em>height chain</em>. Each chain was defined as the <strong>mean absolute difference</strong> between a reference channel and its spatially adjacent channels, thereby encoding local contrast while maintaining robustness to absolute signal shifts.</p>\n<p>Formally, given a set of pairwise differences did_idi, the chain operator is defined as:</p>\n<p>Implementation example:</p>\n<pre><code> ():\n     (d.()  d  diffs) / (diffs)\n\ndf[] = mean_abs_chain([\n    df[] - df[],\n    df[] - df[],\n    df[] - df[],\n])\n\ndf[] = mean_abs_chain([\n    df[] - df[],\n    df[] - df[],\n    df[] - df[],\n])\n\ndf[] = mean_abs_chain([\n    df[] - df[],\n    df[] - df[],\n    df[] - df[],\n    df[] - df[],\n])\n\ndf[] = mean_abs_chain([\n    df[] - df[],\n    df[] - df[],\n])\n</code></pre>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F16438831%2F693e879ece9994844c0ff7d0355d72a7%2Fchain.JPG?generation=1755677371170345&amp;alt=media\" alt=\"\"></p>\n<h2>TOF Feature</h2>\n<p>First of all, We use 5 stats data.</p>\n<table>\n<thead>\n<tr>\n<th><strong>Feature Name</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><strong>tof_1_mean</strong></td>\n<td>Mean value of time-of-flight (ToF) measurements from Sensor Channel 1</td>\n</tr>\n<tr>\n<td><strong>tof_2_mean</strong></td>\n<td>Mean value of time-of-flight (ToF) measurements from Sensor Channel 2</td>\n</tr>\n<tr>\n<td><strong>tof_3_mean</strong></td>\n<td>Mean value of time-of-flight (ToF) measurements from Sensor Channel 3</td>\n</tr>\n<tr>\n<td><strong>tof_4_mean</strong></td>\n<td>Mean value of time-of-flight (ToF) measurements from Sensor Channel 4</td>\n</tr>\n<tr>\n<td><strong>tof_5_mean</strong></td>\n<td>Mean value of time-of-flight (ToF) measurements from Sensor Channel 5</td>\n</tr>\n</tbody>\n</table>\n<hr>\n<p>To enrich the representation of the ToF signals, we introduced a set of spatially localized descriptors. Specifically, we partitioned the sensor array into four quadrants (top-left, top-right, bottom-left, and bottom-right) and computed the mean value within each region. The resulting features—tof_top_left_mean, tof_top_right_mean, tof_bottom_left_mean, and tof_bottom_right_mean—summarize the average ToF response in each spatial quadrant. This design captures coarse-grained spatial structure while retaining robustness against local noise, thereby enhancing the model’s ability to recognize asymmetric spatial patterns.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F16438831%2Ffc36c016e9f2643413632dacf3fe9d5f%2Ftof%20spa.JPG?generation=1755677433973317&amp;alt=media\" alt=\"\"></p>",
  "messages": [
    {
      "id": 3272075,
      "postDate": "2025-08-20T08:12:28.770Z",
      "content": "<h2>THM Feature</h2>\n<p>First of all, We use 5 raw data, and 3 stats data.</p>\n<table>\n<thead>\n<tr>\n<th>Feature Name</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><strong>thm_1</strong></td>\n<td>Raw thermopile measurement (Channel 1)</td>\n</tr>\n<tr>\n<td><strong>thm_2</strong></td>\n<td>Raw thermopile measurement (Channel 2)</td>\n</tr>\n<tr>\n<td><strong>thm_3</strong></td>\n<td>Raw thermopile measurement (Channel 3)</td>\n</tr>\n<tr>\n<td><strong>thm_4</strong></td>\n<td>Raw thermopile measurement (Channel 4)</td>\n</tr>\n<tr>\n<td><strong>thm_5</strong></td>\n<td>Raw thermopile measurement (Channel 5)</td>\n</tr>\n<tr>\n<td><strong>thm_mean</strong></td>\n<td>Statistical feature — mean value across thermopile channels</td>\n</tr>\n<tr>\n<td><strong>thm_std</strong></td>\n<td>Statistical feature — standard deviation across thermopile channels</td>\n</tr>\n<tr>\n<td><strong>thm_range</strong></td>\n<td>Statistical feature — dynamic range (max–min) across thermopile channels</td>\n</tr>\n</tbody>\n</table>\n<hr>\n<p>We further derived <strong>spatial chain features</strong> to capture relative thermal variations across the sensor array. Specifically, four chain descriptors were constructed: <em>right chain</em>, <em>left chain</em>, <em>center chain</em>, and <em>height chain</em>. Each chain was defined as the <strong>mean absolute difference</strong> between a reference channel and its spatially adjacent channels, thereby encoding local contrast while maintaining robustness to absolute signal shifts.</p>\n<p>Formally, given a set of pairwise differences did_idi, the chain operator is defined as:</p>\n<p>Implementation example:</p>\n<pre><code> ():\n     (d.()  d  diffs) / (diffs)\n\ndf[] = mean_abs_chain([\n    df[] - df[],\n    df[] - df[],\n    df[] - df[],\n])\n\ndf[] = mean_abs_chain([\n    df[] - df[],\n    df[] - df[],\n    df[] - df[],\n])\n\ndf[] = mean_abs_chain([\n    df[] - df[],\n    df[] - df[],\n    df[] - df[],\n    df[] - df[],\n])\n\ndf[] = mean_abs_chain([\n    df[] - df[],\n    df[] - df[],\n])\n</code></pre>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F16438831%2F693e879ece9994844c0ff7d0355d72a7%2Fchain.JPG?generation=1755677371170345&amp;alt=media\" alt=\"\"></p>\n<h2>TOF Feature</h2>\n<p>First of all, We use 5 stats data.</p>\n<table>\n<thead>\n<tr>\n<th><strong>Feature Name</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><strong>tof_1_mean</strong></td>\n<td>Mean value of time-of-flight (ToF) measurements from Sensor Channel 1</td>\n</tr>\n<tr>\n<td><strong>tof_2_mean</strong></td>\n<td>Mean value of time-of-flight (ToF) measurements from Sensor Channel 2</td>\n</tr>\n<tr>\n<td><strong>tof_3_mean</strong></td>\n<td>Mean value of time-of-flight (ToF) measurements from Sensor Channel 3</td>\n</tr>\n<tr>\n<td><strong>tof_4_mean</strong></td>\n<td>Mean value of time-of-flight (ToF) measurements from Sensor Channel 4</td>\n</tr>\n<tr>\n<td><strong>tof_5_mean</strong></td>\n<td>Mean value of time-of-flight (ToF) measurements from Sensor Channel 5</td>\n</tr>\n</tbody>\n</table>\n<hr>\n<p>To enrich the representation of the ToF signals, we introduced a set of spatially localized descriptors. Specifically, we partitioned the sensor array into four quadrants (top-left, top-right, bottom-left, and bottom-right) and computed the mean value within each region. The resulting features—tof_top_left_mean, tof_top_right_mean, tof_bottom_left_mean, and tof_bottom_right_mean—summarize the average ToF response in each spatial quadrant. This design captures coarse-grained spatial structure while retaining robustness against local noise, thereby enhancing the model’s ability to recognize asymmetric spatial patterns.</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F16438831%2Ffc36c016e9f2643413632dacf3fe9d5f%2Ftof%20spa.JPG?generation=1755677433973317&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "## THM Feature\n\nFirst of all, We use 5 raw data, and 3 stats data.\n\n| Feature Name | Description |\n| --- | --- |\n| **thm_1** | Raw thermopile measurement (Channel 1) |\n| **thm_2** | Raw thermopile measurement (Channel 2) |\n| **thm_3** | Raw thermopile measurement (Channel 3) |\n| **thm_4** | Raw thermopile measurement (Channel 4) |\n| **thm_5** | Raw thermopile measurement (Channel 5) |\n| **thm_mean** | Statistical feature — mean value across thermopile channels |\n| **thm_std** | Statistical feature — standard deviation across thermopile channels |\n| **thm_range** | Statistical feature — dynamic range (max–min) across thermopile channels |\n\n___\n\nWe further derived **spatial chain features** to capture relative thermal variations across the sensor array. Specifically, four chain descriptors were constructed: *right chain*, *left chain*, *center chain*, and *height chain*. Each chain was defined as the **mean absolute difference** between a reference channel and its spatially adjacent channels, thereby encoding local contrast while maintaining robustness to absolute signal shifts.\n\nFormally, given a set of pairwise differences did_idi, the chain operator is defined as:\n\nImplementation example:\n```python\ndef mean_abs_chain(diffs):\n    return sum(d.abs() for d in diffs) / len(diffs)\n\ndf['thm_right_chain'] = mean_abs_chain([\n    df['thm_3'] - df['thm_2'],\n    df['thm_3'] - df['thm_1'],\n    df['thm_3'] - df['thm_4'],\n])\n\ndf['thm_left_chain'] = mean_abs_chain([\n    df['thm_5'] - df['thm_2'],\n    df['thm_5'] - df['thm_1'],\n    df['thm_5'] - df['thm_4'],\n])\n\ndf['thm_center_chain'] = mean_abs_chain([\n    df['thm_1'] - df['thm_2'],\n    df['thm_1'] - df['thm_3'],\n    df['thm_1'] - df['thm_4'],\n    df['thm_1'] - df['thm_5'],\n])\n\ndf['thm_height_chain'] = mean_abs_chain([\n    df['thm_2'] - df['thm_1'],\n    df['thm_1'] - df['thm_4'],\n])\n```\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F16438831%2F693e879ece9994844c0ff7d0355d72a7%2Fchain.JPG?generation=1755677371170345&alt=media)\n\n## TOF Feature\n\nFirst of all, We use 5 stats data.\n\n| **Feature Name** | **Description** |\n| --- | --- |\n| **tof_1_mean** | Mean value of time-of-flight (ToF) measurements from Sensor Channel 1 |\n| **tof_2_mean** | Mean value of time-of-flight (ToF) measurements from Sensor Channel 2 |\n| **tof_3_mean** | Mean value of time-of-flight (ToF) measurements from Sensor Channel 3 |\n| **tof_4_mean** | Mean value of time-of-flight (ToF) measurements from Sensor Channel 4 |\n| **tof_5_mean** | Mean value of time-of-flight (ToF) measurements from Sensor Channel 5 |\n\n___\n\nTo enrich the representation of the ToF signals, we introduced a set of spatially localized descriptors. Specifically, we partitioned the sensor array into four quadrants (top-left, top-right, bottom-left, and bottom-right) and computed the mean value within each region. The resulting features—tof_top_left_mean, tof_top_right_mean, tof_bottom_left_mean, and tof_bottom_right_mean—summarize the average ToF response in each spatial quadrant. This design captures coarse-grained spatial structure while retaining robustness against local noise, thereby enhancing the model’s ability to recognize asymmetric spatial patterns.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F16438831%2Ffc36c016e9f2643413632dacf3fe9d5f%2Ftof%20spa.JPG?generation=1755677433973317&alt=media)",
      "votes": 5
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "3272075": "## THM Feature\n\nFirst of all, We use 5 raw data, and 3 stats data.\n\n| Feature Name | Description |\n| --- | --- |\n| **thm_1** | Raw thermopile measurement (Channel 1) |\n| **thm_2** | Raw thermopile measurement (Channel 2) |\n| **thm_3** | Raw thermopile measurement (Channel 3) |\n| **thm_4** | Raw thermopile measurement (Channel 4) |\n| **thm_5** | Raw thermopile measurement (Channel 5) |\n| **thm_mean** | Statistical feature — mean value across thermopile channels |\n| **thm_std** | Statistical feature — standard deviation across thermopile channels |\n| **thm_range** | Statistical feature — dynamic range (max–min) across thermopile channels |\n\n___\n\nWe further derived **spatial chain features** to capture relative thermal variations across the sensor array. Specifically, four chain descriptors were constructed: *right chain*, *left chain*, *center chain*, and *height chain*. Each chain was defined as the **mean absolute difference** between a reference channel and its spatially adjacent channels, thereby encoding local contrast while maintaining robustness to absolute signal shifts.\n\nFormally, given a set of pairwise differences did_idi, the chain operator is defined as:\n\nImplementation example:\n```python\ndef mean_abs_chain(diffs):\n    return sum(d.abs() for d in diffs) / len(diffs)\n\ndf['thm_right_chain'] = mean_abs_chain([\n    df['thm_3'] - df['thm_2'],\n    df['thm_3'] - df['thm_1'],\n    df['thm_3'] - df['thm_4'],\n])\n\ndf['thm_left_chain'] = mean_abs_chain([\n    df['thm_5'] - df['thm_2'],\n    df['thm_5'] - df['thm_1'],\n    df['thm_5'] - df['thm_4'],\n])\n\ndf['thm_center_chain'] = mean_abs_chain([\n    df['thm_1'] - df['thm_2'],\n    df['thm_1'] - df['thm_3'],\n    df['thm_1'] - df['thm_4'],\n    df['thm_1'] - df['thm_5'],\n])\n\ndf['thm_height_chain'] = mean_abs_chain([\n    df['thm_2'] - df['thm_1'],\n    df['thm_1'] - df['thm_4'],\n])\n```\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F16438831%2F693e879ece9994844c0ff7d0355d72a7%2Fchain.JPG?generation=1755677371170345&alt=media)\n\n## TOF Feature\n\nFirst of all, We use 5 stats data.\n\n| **Feature Name** | **Description** |\n| --- | --- |\n| **tof_1_mean** | Mean value of time-of-flight (ToF) measurements from Sensor Channel 1 |\n| **tof_2_mean** | Mean value of time-of-flight (ToF) measurements from Sensor Channel 2 |\n| **tof_3_mean** | Mean value of time-of-flight (ToF) measurements from Sensor Channel 3 |\n| **tof_4_mean** | Mean value of time-of-flight (ToF) measurements from Sensor Channel 4 |\n| **tof_5_mean** | Mean value of time-of-flight (ToF) measurements from Sensor Channel 5 |\n\n___\n\nTo enrich the representation of the ToF signals, we introduced a set of spatially localized descriptors. Specifically, we partitioned the sensor array into four quadrants (top-left, top-right, bottom-left, and bottom-right) and computed the mean value within each region. The resulting features—tof_top_left_mean, tof_top_right_mean, tof_bottom_left_mean, and tof_bottom_right_mean—summarize the average ToF response in each spatial quadrant. This design captures coarse-grained spatial structure while retaining robustness against local noise, thereby enhancing the model’s ability to recognize asymmetric spatial patterns.\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F16438831%2Ffc36c016e9f2643413632dacf3fe9d5f%2Ftof%20spa.JPG?generation=1755677433973317&alt=media)"
  }
}