{
  "id": 86818,
  "title": "Has anyone had success for using bandpower features?",
  "url": "/competitions/LANL-Earthquake-Prediction/discussion/86818",
  "author_name": "",
  "post_date": "2019-03-27T01:48:16.273735Z",
  "votes": 3,
  "comment_count": 4,
  "views": 0,
  "content": "<p>I found a stackoverflow post <a href=\"https://stackoverflow.com/questions/44547669/python-numpy-equivalent-of-bandpower-from-matlab\">here</a> on bandpower features:</p>\n\n<p><code>\ndef bandpower(x, fs, fmin, fmax):\n    f, Pxx = scipy.signal.periodogram(x, fs=fs)\n    ind_min = scipy.argmax(f &gt; fmin) - 1\n    ind_max = scipy.argmax(f &gt; fmax) - 1\n    return scipy.trapz(Pxx[ind_min: ind_max], f[ind_min: ind_max])\n</code>\nPerhaps the sampling rate is too high - 4Mhz - so the bandpower I compute is just a bunch of zeros. Do you have any idea?</p>",
  "messages": [
    {
      "id": "501162",
      "postDate": "03/27/2019 01:48:16",
      "content": "<p>I found a stackoverflow post <a href=\"https://stackoverflow.com/questions/44547669/python-numpy-equivalent-of-bandpower-from-matlab\">here</a> on bandpower features:</p>\n\n<p><code>\ndef bandpower(x, fs, fmin, fmax):\n    f, Pxx = scipy.signal.periodogram(x, fs=fs)\n    ind_min = scipy.argmax(f &gt; fmin) - 1\n    ind_max = scipy.argmax(f &gt; fmax) - 1\n    return scipy.trapz(Pxx[ind_min: ind_max], f[ind_min: ind_max])\n</code>\nPerhaps the sampling rate is too high - 4Mhz - so the bandpower I compute is just a bunch of zeros. Do you have any idea?</p>",
      "rawMarkdown": "I found a stackoverflow post [here](https://stackoverflow.com/questions/44547669/python-numpy-equivalent-of-bandpower-from-matlab) on bandpower features:\n\n```\ndef bandpower(x, fs, fmin, fmax):\n    f, Pxx = scipy.signal.periodogram(x, fs=fs)\n    ind_min = scipy.argmax(f &gt; fmin) - 1\n    ind_max = scipy.argmax(f &gt; fmax) - 1\n    return scipy.trapz(Pxx[ind_min: ind_max], f[ind_min: ind_max])\n```\nPerhaps the sampling rate is too high - 4Mhz - so the bandpower I compute is just a bunch of zeros. Do you have any idea?",
      "votes": null
    },
    {
      "id": "501178",
      "postDate": "03/27/2019 02:15:28",
      "content": "<p>My experience: you don't have to use frequency up to 4 mega hertz from the power spectral density. spectrum of low frequency is useful. Spectra of quakes ( time to failure of about 0.3 seconds ) are very unique...</p>",
      "rawMarkdown": "My experience: you don't have to use frequency up to 4 mega hertz from the power spectral density. spectrum of low frequency is useful. Spectra of quakes ( time to failure of about 0.3 seconds ) are very unique...",
      "votes": null
    },
    {
      "id": "501631",
      "postDate": "03/27/2019 15:04:34",
      "content": "<p>I think that pretty much anything related to frequency will be messed up by the gaps every 4096 samples in the data.</p>",
      "rawMarkdown": "I think that pretty much anything related to frequency will be messed up by the gaps every 4096 samples in the data.",
      "votes": null
    },
    {
      "id": "501859",
      "postDate": "03/27/2019 22:08:11",
      "content": "<p>That's so true. I totally forgot to take that into account, especially when the sampling rate is that insanely high.</p>",
      "rawMarkdown": "That's so true. I totally forgot to take that into account, especially when the sampling rate is that insanely high.",
      "votes": null
    },
    {
      "id": "502553",
      "postDate": "03/28/2019 18:19:30",
      "content": "<p>Hi Frank, time ago I did an EDA on the frequency domain <a href=\"https://www.kaggle.com/aperezhortal/eda-on-the-frequency-domain-fft\">(See here)</a> to see if some frequencies were more important than others. \nI tried new features based in the band-power around the peaks in the spectra without any success. The correlation between the power and these features and the quake time was very low.  When they were used in addition to the commonly used features, the CV scores where lower. </p>\n\n<p>I also tried filtering the signal on several bands and compute new features on the band-pass filtered signal. Again, without any success...</p>\n\n<p>Hope this helps.\nAndres</p>",
      "rawMarkdown": "Hi Frank, time ago I did an EDA on the frequency domain [(See here)](https://www.kaggle.com/aperezhortal/eda-on-the-frequency-domain-fft) to see if some frequencies were more important than others. \nI tried new features based in the band-power around the peaks in the spectra without any success. The correlation between the power and these features and the quake time was very low.  When they were used in addition to the commonly used features, the CV scores where lower. \n\nI also tried filtering the signal on several bands and compute new features on the band-pass filtered signal. Again, without any success...\n\nHope this helps.\nAndres",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 501178,
      "author_name": "zhixuanliu",
      "author_url": "",
      "post_date": "03/27/2019 02:15:28",
      "content": "<p>My experience: you don't have to use frequency up to 4 mega hertz from the power spectral density. spectrum of low frequency is useful. Spectra of quakes ( time to failure of about 0.3 seconds ) are very unique...</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 501631,
      "author_name": "angrim",
      "author_url": "",
      "post_date": "03/27/2019 15:04:34",
      "content": "<p>I think that pretty much anything related to frequency will be messed up by the gaps every 4096 samples in the data.</p>",
      "votes": null,
      "replies": [
        {
          "id": 501859,
          "author_name": "pukkinming",
          "author_url": "",
          "post_date": "03/27/2019 22:08:11",
          "content": "<p>That's so true. I totally forgot to take that into account, especially when the sampling rate is that insanely high.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 502553,
      "author_name": "aperezhortal",
      "author_url": "",
      "post_date": "03/28/2019 18:19:30",
      "content": "<p>Hi Frank, time ago I did an EDA on the frequency domain <a href=\"https://www.kaggle.com/aperezhortal/eda-on-the-frequency-domain-fft\">(See here)</a> to see if some frequencies were more important than others. \nI tried new features based in the band-power around the peaks in the spectra without any success. The correlation between the power and these features and the quake time was very low.  When they were used in addition to the commonly used features, the CV scores where lower. </p>\n\n<p>I also tried filtering the signal on several bands and compute new features on the band-pass filtered signal. Again, without any success...</p>\n\n<p>Hope this helps.\nAndres</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "501162": "I found a stackoverflow post [here](https://stackoverflow.com/questions/44547669/python-numpy-equivalent-of-bandpower-from-matlab) on bandpower features:\n\n```\ndef bandpower(x, fs, fmin, fmax):\n    f, Pxx = scipy.signal.periodogram(x, fs=fs)\n    ind_min = scipy.argmax(f &gt; fmin) - 1\n    ind_max = scipy.argmax(f &gt; fmax) - 1\n    return scipy.trapz(Pxx[ind_min: ind_max], f[ind_min: ind_max])\n```\nPerhaps the sampling rate is too high - 4Mhz - so the bandpower I compute is just a bunch of zeros. Do you have any idea?",
    "501178": "My experience: you don't have to use frequency up to 4 mega hertz from the power spectral density. spectrum of low frequency is useful. Spectra of quakes ( time to failure of about 0.3 seconds ) are very unique...",
    "501631": "I think that pretty much anything related to frequency will be messed up by the gaps every 4096 samples in the data.",
    "501859": "That's so true. I totally forgot to take that into account, especially when the sampling rate is that insanely high.",
    "502553": "Hi Frank, time ago I did an EDA on the frequency domain [(See here)](https://www.kaggle.com/aperezhortal/eda-on-the-frequency-domain-fft) to see if some frequencies were more important than others. \nI tried new features based in the band-power around the peaks in the spectra without any success. The correlation between the power and these features and the quake time was very low.  When they were used in addition to the commonly used features, the CV scores where lower. \n\nI also tried filtering the signal on several bands and compute new features on the band-pass filtered signal. Again, without any success...\n\nHope this helps.\nAndres"
  },
  "source": "meta"
}