{
  "id": 612940,
  "title": "How to Handle Null Value in Predictions",
  "url": "/competitions/physionet-ecg-image-digitization/discussion/612940",
  "author_name": "",
  "post_date": "2025-10-23T05:19:15.431008900Z",
  "votes": -1,
  "comment_count": 1,
  "views": 0,
  "content": "<p><a href=\"https://www.kaggle.com/matthewreyna\" target=\"_blank\">@matthewreyna</a> <a href=\"https://www.kaggle.com/gdclifford\" target=\"_blank\">@gdclifford</a></p>\n<p>About competition metric, how can we handle null value in the predictions?<br>\n<a href=\"https://www.kaggle.com/code/metric/physionet-ecg-signal-extraction-metric\" target=\"_blank\">Current competition metric</a> doesn't accept null/nan value, so I guess null should be filled with zero.</p>\n<p>If it is correct, I think current calibration in competition metric calculation is not working correctly.<br>\nIf we fill zero to null, the true mean value (i.e. nanmean value) is shifted with bias in prediction, and perfect prediction with only constant bias parameter does not get perfect score. </p>\n<p>E.x. comment from current competition metric demonstrates null is filled with dc_noise, but since we cant know the actual value of DC noise, we can't fill it with 10.</p>\n<pre><code>    &gt;&gt;&gt; \n    &gt;&gt;&gt; label = np.array([, , , , ])\n    &gt;&gt;&gt; pred = np.array([, , , , ])\n    &gt;&gt;&gt; aligned = align_signals(label, pred)\n    &gt;&gt;&gt; expected_array = np.array([, , , , ])\n    &gt;&gt;&gt; np.allclose(aligned, expected_array, equal_nan=)\n    \n</code></pre>",
  "messages": [
    {
      "id": "3305603",
      "postDate": "10/23/2025 05:19:15",
      "content": "<p><a href=\"https://www.kaggle.com/matthewreyna\" target=\"_blank\">@matthewreyna</a> <a href=\"https://www.kaggle.com/gdclifford\" target=\"_blank\">@gdclifford</a></p>\n<p>About competition metric, how can we handle null value in the predictions?<br>\n<a href=\"https://www.kaggle.com/code/metric/physionet-ecg-signal-extraction-metric\" target=\"_blank\">Current competition metric</a> doesn't accept null/nan value, so I guess null should be filled with zero.</p>\n<p>If it is correct, I think current calibration in competition metric calculation is not working correctly.<br>\nIf we fill zero to null, the true mean value (i.e. nanmean value) is shifted with bias in prediction, and perfect prediction with only constant bias parameter does not get perfect score. </p>\n<p>E.x. comment from current competition metric demonstrates null is filled with dc_noise, but since we cant know the actual value of DC noise, we can't fill it with 10.</p>\n<pre><code>    &gt;&gt;&gt; \n    &gt;&gt;&gt; label = np.array([, , , , ])\n    &gt;&gt;&gt; pred = np.array([, , , , ])\n    &gt;&gt;&gt; aligned = align_signals(label, pred)\n    &gt;&gt;&gt; expected_array = np.array([, , , , ])\n    &gt;&gt;&gt; np.allclose(aligned, expected_array, equal_nan=)\n    \n</code></pre>",
      "rawMarkdown": "matthewreyna @gdclifford\n\nAbout competition metric, how can we handle null value in the predictions?\n[Current competition metric](https://www.kaggle.com/code/metric/physionet-ecg-signal-extraction-metric) doesn't accept null/nan value, so I guess null should be filled with zero.\n\nIf it is correct, I think current calibration in competition metric calculation is not working correctly.\nIf we fill zero to null, the true mean value (i.e. nanmean value) is shifted with bias in prediction, and perfect prediction with only constant bias parameter does not get perfect score. \n\nE.x. comment from current competition metric demonstrates null is filled with dc_noise, but since we cant know the actual value of DC noise, we can't fill it with 10.\n\n```python\n    >>> # Test 2: Vertical shift (DC offset) should be removed\n    >>> label = np.array([0, 1, 2, 1, 0])\n    >>> pred = np.array([10, 11, 12, 11, 10])\n    >>> aligned = align_signals(label, pred)\n    >>> expected_array = np.array([0, 1, 2, 1, 0])\n    >>> np.allclose(aligned, expected_array, equal_nan=True)\n    True\n```",
      "votes": null
    },
    {
      "id": "3305799",
      "postDate": "10/23/2025 13:18:47",
      "content": "<p>Please see the response to a similar, earlier comment: <br>\n<a href=\"https://www.kaggle.com/competitions/physionet-ecg-image-digitization/discussion/612929#3305552\" target=\"_blank\">https://www.kaggle.com/competitions/physionet-ecg-image-digitization/discussion/612929#3305552</a></p>",
      "rawMarkdown": "Please see the response to a similar, earlier comment: \nhttps://www.kaggle.com/competitions/physionet-ecg-image-digitization/discussion/612929#3305552",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 3305799,
      "author_name": "gdclifford",
      "author_url": "",
      "post_date": "10/23/2025 13:18:47",
      "content": "<p>Please see the response to a similar, earlier comment: <br>\n<a href=\"https://www.kaggle.com/competitions/physionet-ecg-image-digitization/discussion/612929#3305552\" target=\"_blank\">https://www.kaggle.com/competitions/physionet-ecg-image-digitization/discussion/612929#3305552</a></p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "3305603": "matthewreyna @gdclifford\n\nAbout competition metric, how can we handle null value in the predictions?\n[Current competition metric](https://www.kaggle.com/code/metric/physionet-ecg-signal-extraction-metric) doesn't accept null/nan value, so I guess null should be filled with zero.\n\nIf it is correct, I think current calibration in competition metric calculation is not working correctly.\nIf we fill zero to null, the true mean value (i.e. nanmean value) is shifted with bias in prediction, and perfect prediction with only constant bias parameter does not get perfect score. \n\nE.x. comment from current competition metric demonstrates null is filled with dc_noise, but since we cant know the actual value of DC noise, we can't fill it with 10.\n\n```python\n    >>> # Test 2: Vertical shift (DC offset) should be removed\n    >>> label = np.array([0, 1, 2, 1, 0])\n    >>> pred = np.array([10, 11, 12, 11, 10])\n    >>> aligned = align_signals(label, pred)\n    >>> expected_array = np.array([0, 1, 2, 1, 0])\n    >>> np.allclose(aligned, expected_array, equal_nan=True)\n    True\n```",
    "3305799": "Please see the response to a similar, earlier comment: \nhttps://www.kaggle.com/competitions/physionet-ecg-image-digitization/discussion/612929#3305552"
  },
  "source": "meta"
}