{
  "id": 245950,
  "title": "Non Negative Matrix Factorization for RFI Reduction",
  "url": "/competitions/seti-breakthrough-listen/discussion/245950",
  "author_name": "Manav",
  "post_date": "2021-06-13T08:22:00.112000",
  "votes": 26,
  "comment_count": 11,
  "views": 0,
  "content": "<p>Hi fellow Kagglers,</p>\n<p>As I am sure most of us would have seen examples as shown below where there is a constant band across a particular frequency in both the ON and OFF scenarios.</p>\n<p><img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/0a47af6a917c_original.png?raw=true\" alt=\"\"></p>\n<p>So technically that is not adding any additional useful information to the signal and is most likely caused by a consistent source of <strong>Radio Frequency Interference (RFI)</strong>. It also looks similar to some of the positive example as illustrated below, it might be a source of confusion/contradiction for the model.</p>\n<p><img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/0b57c2f1504d.png?raw=true\" alt=\"\"></p>\n<p><strong>How to get rid of such bands?</strong></p>\n<p>We already know from the Data Description that:-</p>\n<blockquote>\n  <p>One method we use to isolate candidate techno signatures from RFI is to look for signals that appear to be coming from particular positions on the sky. Typically we do this by alternating observations of our primary target star with observations of three nearby stars: 5 minutes on star “A”, then 5 minutes on star “B”, then back to star “A” for 5 minutes, then “C”, then back to “A”, then finishing with 5 minutes on star “D”.</p>\n</blockquote>\n<p>This gives us two possibilities:-</p>\n<p><strong>1. Taking difference between even and odd channels</strong><br>\nTaking scalar difference between subsequent even and odd channels will help to eliminate bands which are exactly same in both the ON and OFF channels.<br>\nExample:-<br>\n<img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/difference_only.png?raw=true\" alt=\"\"></p>\n<p><strong>2. Comparing NMF of ON and OFF images</strong><br>\nIn this method we decompose both the ON and OFF images into their base matrices W and H whose product approximates the ON/OFF matrix respectively. Then we reconstruct the noise matrix by multiplying the constituent matrix W of ON snippet with the matrix H of OFF snippet. This noise matrix is then subtracted from the ON snippet to get a clean representation of the signal. <br>\nThis basically recreates the features which are unique to the ON and OFF snippets while eliminating anything in common.<br>\nExample:-<br>\n<img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_3.png?raw=true\" alt=\"\"></p>\n<p><strong>The function used to create these Images can be found in <a href=\"https://www.kaggle.com/manabendrarout/rfi-reduction-ideas-examples-seti\" target=\"_blank\">this Notebook</a></strong></p>\n<p><strong>Assumption:-</strong><br>\nWe can do this as it is clarified by <a href=\"https://www.kaggle.com/stevecroft\" target=\"_blank\">@stevecroft</a> in <a href=\"https://www.kaggle.com/c/seti-breakthrough-listen/discussion/241475\" target=\"_blank\">this</a> discussion thread that the observations are taken sequentially one after the other and I am assuming the external sources of noise remain the same within that period.</p>\n<p>Some more examples can be found below:-</p>\n<ol>\n<li><br>\n<img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_2.png?raw=true\" alt=\"\"></li>\n<li><br>\n<img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_4.png?raw=true\" alt=\"\"></li>\n<li><br>\n<img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_6.png?raw=true\" alt=\"\"></li>\n<li><br>\n<img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_9.png?raw=true\" alt=\"\"></li>\n<li><br>\n<img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_8.png?raw=true\" alt=\"\"></li>\n</ol>\n<p><strong>The function used to create these Images can be found in <a href=\"https://www.kaggle.com/manabendrarout/rfi-reduction-ideas-examples-seti\" target=\"_blank\">this Notebook</a></strong></p>\n<p>Things that did not work:-</p>\n<ol>\n<li>PCA for Noise reduction</li>\n<li>SVD for matrix decomposition and noise re-construction</li>\n</ol>\n<p>Hope you find this useful. 😊</p>\n<p><strong>UPDATE:-</strong><br>\nAs clarified by <a href=\"https://www.kaggle.com/yuhongc\" target=\"_blank\">@yuhongc</a> in the comments below:- </p>\n<blockquote>\n  <p><strong>The vertical bright line is what we call a DC spike</strong>, and is an artifact from the way we convert the raw signal from the telescope into spectrograms. We left them in because we wanted the data to be as realistic as possible, and it happens to be one of the simplest forms of interference (<strong>although technically not RFI</strong>).</p>\n</blockquote>",
  "messages": [
    {
      "id": 1347466,
      "postDate": "2021-06-13T08:22:00.113Z",
      "content": "<p>Hi fellow Kagglers,</p>\n<p>As I am sure most of us would have seen examples as shown below where there is a constant band across a particular frequency in both the ON and OFF scenarios.</p>\n<p><img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/0a47af6a917c_original.png?raw=true\" alt=\"\"></p>\n<p>So technically that is not adding any additional useful information to the signal and is most likely caused by a consistent source of <strong>Radio Frequency Interference (RFI)</strong>. It also looks similar to some of the positive example as illustrated below, it might be a source of confusion/contradiction for the model.</p>\n<p><img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/0b57c2f1504d.png?raw=true\" alt=\"\"></p>\n<p><strong>How to get rid of such bands?</strong></p>\n<p>We already know from the Data Description that:-</p>\n<blockquote>\n  <p>One method we use to isolate candidate techno signatures from RFI is to look for signals that appear to be coming from particular positions on the sky. Typically we do this by alternating observations of our primary target star with observations of three nearby stars: 5 minutes on star “A”, then 5 minutes on star “B”, then back to star “A” for 5 minutes, then “C”, then back to “A”, then finishing with 5 minutes on star “D”.</p>\n</blockquote>\n<p>This gives us two possibilities:-</p>\n<p><strong>1. Taking difference between even and odd channels</strong><br>\nTaking scalar difference between subsequent even and odd channels will help to eliminate bands which are exactly same in both the ON and OFF channels.<br>\nExample:-<br>\n<img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/difference_only.png?raw=true\" alt=\"\"></p>\n<p><strong>2. Comparing NMF of ON and OFF images</strong><br>\nIn this method we decompose both the ON and OFF images into their base matrices W and H whose product approximates the ON/OFF matrix respectively. Then we reconstruct the noise matrix by multiplying the constituent matrix W of ON snippet with the matrix H of OFF snippet. This noise matrix is then subtracted from the ON snippet to get a clean representation of the signal. <br>\nThis basically recreates the features which are unique to the ON and OFF snippets while eliminating anything in common.<br>\nExample:-<br>\n<img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_3.png?raw=true\" alt=\"\"></p>\n<p><strong>The function used to create these Images can be found in <a href=\"https://www.kaggle.com/manabendrarout/rfi-reduction-ideas-examples-seti\" target=\"_blank\">this Notebook</a></strong></p>\n<p><strong>Assumption:-</strong><br>\nWe can do this as it is clarified by <a href=\"https://www.kaggle.com/stevecroft\" target=\"_blank\">@stevecroft</a> in <a href=\"https://www.kaggle.com/c/seti-breakthrough-listen/discussion/241475\" target=\"_blank\">this</a> discussion thread that the observations are taken sequentially one after the other and I am assuming the external sources of noise remain the same within that period.</p>\n<p>Some more examples can be found below:-</p>\n<ol>\n<li><br>\n<img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_2.png?raw=true\" alt=\"\"></li>\n<li><br>\n<img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_4.png?raw=true\" alt=\"\"></li>\n<li><br>\n<img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_6.png?raw=true\" alt=\"\"></li>\n<li><br>\n<img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_9.png?raw=true\" alt=\"\"></li>\n<li><br>\n<img src=\"https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_8.png?raw=true\" alt=\"\"></li>\n</ol>\n<p><strong>The function used to create these Images can be found in <a href=\"https://www.kaggle.com/manabendrarout/rfi-reduction-ideas-examples-seti\" target=\"_blank\">this Notebook</a></strong></p>\n<p>Things that did not work:-</p>\n<ol>\n<li>PCA for Noise reduction</li>\n<li>SVD for matrix decomposition and noise re-construction</li>\n</ol>\n<p>Hope you find this useful. 😊</p>\n<p><strong>UPDATE:-</strong><br>\nAs clarified by <a href=\"https://www.kaggle.com/yuhongc\" target=\"_blank\">@yuhongc</a> in the comments below:- </p>\n<blockquote>\n  <p><strong>The vertical bright line is what we call a DC spike</strong>, and is an artifact from the way we convert the raw signal from the telescope into spectrograms. We left them in because we wanted the data to be as realistic as possible, and it happens to be one of the simplest forms of interference (<strong>although technically not RFI</strong>).</p>\n</blockquote>",
      "rawMarkdown": "Hi fellow Kagglers,\n\nAs I am sure most of us would have seen examples as shown below where there is a constant band across a particular frequency in both the ON and OFF scenarios.\n\n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/0a47af6a917c_original.png?raw=true)\n\nSo technically that is not adding any additional useful information to the signal and is most likely caused by a consistent source of **Radio Frequency Interference (RFI)**. It also looks similar to some of the positive example as illustrated below, it might be a source of confusion/contradiction for the model.\n\n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/0b57c2f1504d.png?raw=true)\n\n**How to get rid of such bands?**\n\nWe already know from the Data Description that:-\n>One method we use to isolate candidate techno signatures from RFI is to look for signals that appear to be coming from particular positions on the sky. Typically we do this by alternating observations of our primary target star with observations of three nearby stars: 5 minutes on star “A”, then 5 minutes on star “B”, then back to star “A” for 5 minutes, then “C”, then back to “A”, then finishing with 5 minutes on star “D”.\n\nThis gives us two possibilities:-\n\n**1. Taking difference between even and odd channels**\nTaking scalar difference between subsequent even and odd channels will help to eliminate bands which are exactly same in both the ON and OFF channels.\nExample:-\n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/difference_only.png?raw=true)\n\n**2. Comparing NMF of ON and OFF images**\nIn this method we decompose both the ON and OFF images into their base matrices W and H whose product approximates the ON/OFF matrix respectively. Then we reconstruct the noise matrix by multiplying the constituent matrix W of ON snippet with the matrix H of OFF snippet. This noise matrix is then subtracted from the ON snippet to get a clean representation of the signal. \nThis basically recreates the features which are unique to the ON and OFF snippets while eliminating anything in common.\nExample:-\n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_3.png?raw=true)\n\n**The function used to create these Images can be found in [this Notebook](https://www.kaggle.com/manabendrarout/rfi-reduction-ideas-examples-seti)**\n\n**Assumption:-**\nWe can do this as it is clarified by @stevecroft in [this](https://www.kaggle.com/c/seti-breakthrough-listen/discussion/241475) discussion thread that the observations are taken sequentially one after the other and I am assuming the external sources of noise remain the same within that period.\n\nSome more examples can be found below:-\n1. \n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_2.png?raw=true)\n2. \n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_4.png?raw=true)\n3. \n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_6.png?raw=true)\n4. \n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_9.png?raw=true)\n5. \n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_8.png?raw=true)\n\n**The function used to create these Images can be found in [this Notebook](https://www.kaggle.com/manabendrarout/rfi-reduction-ideas-examples-seti)**\n\nThings that did not work:-\n1. PCA for Noise reduction\n2. SVD for matrix decomposition and noise re-construction\n\nHope you find this useful. 😊\n\n**UPDATE:-**\nAs clarified by @yuhongc in the comments below:- \n> **The vertical bright line is what we call a DC spike**, and is an artifact from the way we convert the raw signal from the telescope into spectrograms. We left them in because we wanted the data to be as realistic as possible, and it happens to be one of the simplest forms of interference (**although technically not RFI**).",
      "votes": 26
    },
    {
      "id": 1348157,
      "postDate": "2021-06-13T19:17:31.620Z",
      "content": "<p>This isn't really related to the Non Negative Matrix factorization, but the vertical bright line is what we call a DC spike, and is an artifact from the way we convert the raw signal from the telescope into spectrograms. We left them in because we wanted the data to be as realistic as possible, and it happens to be one of the simplest forms of interference (although technically not RFI).</p>",
      "rawMarkdown": "This isn't really related to the Non Negative Matrix factorization, but the vertical bright line is what we call a DC spike, and is an artifact from the way we convert the raw signal from the telescope into spectrograms. We left them in because we wanted the data to be as realistic as possible, and it happens to be one of the simplest forms of interference (although technically not RFI).",
      "votes": 5,
      "replies": [
        {
          "id": 1348162,
          "postDate": "2021-06-13T19:27:54.390Z",
          "content": "<p>Thanks for the clarification <a href=\"https://www.kaggle.com/yuhongc\" target=\"_blank\">@yuhongc</a> <br>\nIt really makes a lot of sense considering the frequency is perfectly constant and magnitude is a lot higher.<br>\nI will add it as an update to my topic. 😊</p>",
          "rawMarkdown": "Thanks for the clarification @yuhongc \nIt really makes a lot of sense considering the frequency is perfectly constant and magnitude is a lot higher.\nI will add it as an update to my topic. 😊",
          "votes": 1
        }
      ]
    },
    {
      "id": 1347474,
      "postDate": "2021-06-13T08:34:54.430Z",
      "content": "<p>Perfect. <br>\nI am training network by using similar preprocessing function. <br>\nJust waiting for it to converge. </p>",
      "rawMarkdown": "Perfect. \nI am training network by using similar preprocessing function. \nJust waiting for it to converge. ",
      "votes": 2,
      "replies": [
        {
          "id": 1347479,
          "postDate": "2021-06-13T08:37:20.950Z",
          "content": "<p>Good to know. I am also waiting for it to converge… If it is no trouble, kindly update how it went after it is done! I am also having a similar approach but limited by my compute capabilities 😓</p>",
          "rawMarkdown": "Good to know. I am also waiting for it to converge... If it is no trouble, kindly update how it went after it is done! I am also having a similar approach but limited by my compute capabilities 😓",
          "votes": 1
        },
        {
          "id": 1347483,
          "postDate": "2021-06-13T08:39:21.520Z",
          "content": "<p>Sure.       </p>",
          "rawMarkdown": "Sure.       ",
          "votes": 2
        },
        {
          "id": 1348011,
          "postDate": "2021-06-13T16:32:00.370Z",
          "content": "<p><strong>Update:-</strong><br>\nMy model converges at ~25 epochs. I am getting 0.991 CV|0.97x LB with 1xResnet18d vanilla model. No k-fold ensemble.<br>\nProbably need to run with a slightly bigger model. I am thinking Resnet34d or Efficientnet B0 with 5-fold ensemble.</p>",
          "rawMarkdown": "**Update:-**\nMy model converges at ~25 epochs. I am getting 0.991 CV|0.97x LB with 1xResnet18d vanilla model. No k-fold ensemble.\nProbably need to run with a slightly bigger model. I am thinking Resnet34d or Efficientnet B0 with 5-fold ensemble."
        },
        {
          "id": 1348145,
          "postDate": "2021-06-13T19:07:06.907Z",
          "content": "<p>Wow. I am getting 0.97 CV at 21 Epochs. :( </p>",
          "rawMarkdown": "Wow. I am getting 0.97 CV at 21 Epochs. :( "
        }
      ]
    },
    {
      "id": 1348888,
      "postDate": "2021-06-14T11:07:44.983Z",
      "content": "<p>Thanks for sharing this <a href=\"https://www.kaggle.com/manabendrarout\" target=\"_blank\">@manabendrarout</a>. I have a quick question - when you put in an image X there are <code>max_iter</code> times the model tries to optimize the distance between X and W, H (non-negative matrices). However, for many images, the default <code>max_iter=200</code> is not sufficient to converge and throws a ConvergenceWarning. How are you ensuring that each image and the non-negative matrix are converged properly? </p>",
      "rawMarkdown": "Thanks for sharing this @manabendrarout. I have a quick question - when you put in an image X there are `max_iter` times the model tries to optimize the distance between X and W, H (non-negative matrices). However, for many images, the default `max_iter=200` is not sufficient to converge and throws a ConvergenceWarning. How are you ensuring that each image and the non-negative matrix are converged properly? ",
      "replies": [
        {
          "id": 1349004,
          "postDate": "2021-06-14T12:57:07.090Z",
          "content": "<p>Good question <a href=\"https://www.kaggle.com/ayuraj\" target=\"_blank\">@ayuraj</a> <br>\nI was also facing a similar problem when I started with this idea. The trick is that you need to reduce the number of components. You can find the working code <a href=\"https://www.kaggle.com/manabendrarout/rfi-reduction-ideas-examples-seti\" target=\"_blank\">here</a>. This does not throw any error and works much faster as well.</p>",
          "rawMarkdown": "Good question @ayuraj \nI was also facing a similar problem when I started with this idea. The trick is that you need to reduce the number of components. You can find the working code [here](https://www.kaggle.com/manabendrarout/rfi-reduction-ideas-examples-seti). This does not throw any error and works much faster as well."
        }
      ]
    },
    {
      "id": 1348335,
      "postDate": "2021-06-14T01:22:34.953Z",
      "content": "<p>Thanks for sharing!!<br>\nwhen you use this, you save denoised image before run training code?</p>",
      "rawMarkdown": "Thanks for sharing!!\nwhen you use this, you save denoised image before run training code?",
      "replies": [
        {
          "id": 1348594,
          "postDate": "2021-06-14T06:29:08.967Z",
          "content": "<p>Yes <a href=\"https://www.kaggle.com/abebe9849\" target=\"_blank\">@abebe9849</a> <br>\nI also tried to implement this in the pipeline directly, but that was making the iterations vert very slow.</p>",
          "rawMarkdown": "Yes @abebe9849 \nI also tried to implement this in the pipeline directly, but that was making the iterations vert very slow.",
          "votes": 2
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 1348157,
      "author_name": "Yuhong Chen",
      "author_url": "",
      "post_date": "2021-06-13T19:17:31.620000",
      "content": "<p>This isn't really related to the Non Negative Matrix factorization, but the vertical bright line is what we call a DC spike, and is an artifact from the way we convert the raw signal from the telescope into spectrograms. We left them in because we wanted the data to be as realistic as possible, and it happens to be one of the simplest forms of interference (although technically not RFI).</p>",
      "votes": 5,
      "replies": [
        {
          "id": 1348162,
          "author_name": "Manav",
          "author_url": "",
          "post_date": "2021-06-13T19:27:54.390000",
          "content": "<p>Thanks for the clarification <a href=\"https://www.kaggle.com/yuhongc\" target=\"_blank\">@yuhongc</a> <br>\nIt really makes a lot of sense considering the frequency is perfectly constant and magnitude is a lot higher.<br>\nI will add it as an update to my topic. 😊</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 1347474,
      "author_name": "Salman",
      "author_url": "",
      "post_date": "2021-06-13T08:34:54.430000",
      "content": "<p>Perfect. <br>\nI am training network by using similar preprocessing function. <br>\nJust waiting for it to converge. </p>",
      "votes": 2,
      "replies": [
        {
          "id": 1347479,
          "author_name": "Manav",
          "author_url": "",
          "post_date": "2021-06-13T08:37:20.950000",
          "content": "<p>Good to know. I am also waiting for it to converge… If it is no trouble, kindly update how it went after it is done! I am also having a similar approach but limited by my compute capabilities 😓</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1347483,
          "author_name": "Salman",
          "author_url": "",
          "post_date": "2021-06-13T08:39:21.520000",
          "content": "<p>Sure.       </p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 1348011,
          "author_name": "Manav",
          "author_url": "",
          "post_date": "2021-06-13T16:32:00.370000",
          "content": "<p><strong>Update:-</strong><br>\nMy model converges at ~25 epochs. I am getting 0.991 CV|0.97x LB with 1xResnet18d vanilla model. No k-fold ensemble.<br>\nProbably need to run with a slightly bigger model. I am thinking Resnet34d or Efficientnet B0 with 5-fold ensemble.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1348145,
          "author_name": "Salman",
          "author_url": "",
          "post_date": "2021-06-13T19:07:06.907000",
          "content": "<p>Wow. I am getting 0.97 CV at 21 Epochs. :( </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1348888,
      "author_name": "Ayush Thakur",
      "author_url": "",
      "post_date": "2021-06-14T11:07:44.983000",
      "content": "<p>Thanks for sharing this <a href=\"https://www.kaggle.com/manabendrarout\" target=\"_blank\">@manabendrarout</a>. I have a quick question - when you put in an image X there are <code>max_iter</code> times the model tries to optimize the distance between X and W, H (non-negative matrices). However, for many images, the default <code>max_iter=200</code> is not sufficient to converge and throws a ConvergenceWarning. How are you ensuring that each image and the non-negative matrix are converged properly? </p>",
      "votes": 0,
      "replies": [
        {
          "id": 1349004,
          "author_name": "Manav",
          "author_url": "",
          "post_date": "2021-06-14T12:57:07.090000",
          "content": "<p>Good question <a href=\"https://www.kaggle.com/ayuraj\" target=\"_blank\">@ayuraj</a> <br>\nI was also facing a similar problem when I started with this idea. The trick is that you need to reduce the number of components. You can find the working code <a href=\"https://www.kaggle.com/manabendrarout/rfi-reduction-ideas-examples-seti\" target=\"_blank\">here</a>. This does not throw any error and works much faster as well.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1348335,
      "author_name": "patriot",
      "author_url": "",
      "post_date": "2021-06-14T01:22:34.953000",
      "content": "<p>Thanks for sharing!!<br>\nwhen you use this, you save denoised image before run training code?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 1348594,
          "author_name": "Manav",
          "author_url": "",
          "post_date": "2021-06-14T06:29:08.967000",
          "content": "<p>Yes <a href=\"https://www.kaggle.com/abebe9849\" target=\"_blank\">@abebe9849</a> <br>\nI also tried to implement this in the pipeline directly, but that was making the iterations vert very slow.</p>",
          "votes": 2,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1347466": "Hi fellow Kagglers,\n\nAs I am sure most of us would have seen examples as shown below where there is a constant band across a particular frequency in both the ON and OFF scenarios.\n\n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/0a47af6a917c_original.png?raw=true)\n\nSo technically that is not adding any additional useful information to the signal and is most likely caused by a consistent source of **Radio Frequency Interference (RFI)**. It also looks similar to some of the positive example as illustrated below, it might be a source of confusion/contradiction for the model.\n\n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/0b57c2f1504d.png?raw=true)\n\n**How to get rid of such bands?**\n\nWe already know from the Data Description that:-\n>One method we use to isolate candidate techno signatures from RFI is to look for signals that appear to be coming from particular positions on the sky. Typically we do this by alternating observations of our primary target star with observations of three nearby stars: 5 minutes on star “A”, then 5 minutes on star “B”, then back to star “A” for 5 minutes, then “C”, then back to “A”, then finishing with 5 minutes on star “D”.\n\nThis gives us two possibilities:-\n\n**1. Taking difference between even and odd channels**\nTaking scalar difference between subsequent even and odd channels will help to eliminate bands which are exactly same in both the ON and OFF channels.\nExample:-\n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/difference_only.png?raw=true)\n\n**2. Comparing NMF of ON and OFF images**\nIn this method we decompose both the ON and OFF images into their base matrices W and H whose product approximates the ON/OFF matrix respectively. Then we reconstruct the noise matrix by multiplying the constituent matrix W of ON snippet with the matrix H of OFF snippet. This noise matrix is then subtracted from the ON snippet to get a clean representation of the signal. \nThis basically recreates the features which are unique to the ON and OFF snippets while eliminating anything in common.\nExample:-\n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_3.png?raw=true)\n\n**The function used to create these Images can be found in [this Notebook](https://www.kaggle.com/manabendrarout/rfi-reduction-ideas-examples-seti)**\n\n**Assumption:-**\nWe can do this as it is clarified by @stevecroft in [this](https://www.kaggle.com/c/seti-breakthrough-listen/discussion/241475) discussion thread that the observations are taken sequentially one after the other and I am assuming the external sources of noise remain the same within that period.\n\nSome more examples can be found below:-\n1. \n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_2.png?raw=true)\n2. \n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_4.png?raw=true)\n3. \n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_6.png?raw=true)\n4. \n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_9.png?raw=true)\n5. \n![](https://github.com/mrout94/Corona_Virus_Spread_Timelapse/blob/master/img_temp/nmf_example_8.png?raw=true)\n\n**The function used to create these Images can be found in [this Notebook](https://www.kaggle.com/manabendrarout/rfi-reduction-ideas-examples-seti)**\n\nThings that did not work:-\n1. PCA for Noise reduction\n2. SVD for matrix decomposition and noise re-construction\n\nHope you find this useful. 😊\n\n**UPDATE:-**\nAs clarified by @yuhongc in the comments below:- \n> **The vertical bright line is what we call a DC spike**, and is an artifact from the way we convert the raw signal from the telescope into spectrograms. We left them in because we wanted the data to be as realistic as possible, and it happens to be one of the simplest forms of interference (**although technically not RFI**).",
    "1348157": "This isn't really related to the Non Negative Matrix factorization, but the vertical bright line is what we call a DC spike, and is an artifact from the way we convert the raw signal from the telescope into spectrograms. We left them in because we wanted the data to be as realistic as possible, and it happens to be one of the simplest forms of interference (although technically not RFI).",
    "1347474": "Perfect. \nI am training network by using similar preprocessing function. \nJust waiting for it to converge. ",
    "1348888": "Thanks for sharing this @manabendrarout. I have a quick question - when you put in an image X there are `max_iter` times the model tries to optimize the distance between X and W, H (non-negative matrices). However, for many images, the default `max_iter=200` is not sufficient to converge and throws a ConvergenceWarning. How are you ensuring that each image and the non-negative matrix are converged properly? ",
    "1348335": "Thanks for sharing!!\nwhen you use this, you save denoised image before run training code?"
  }
}