{
  "id": 543686,
  "title": "11th place solution",
  "url": "/competitions/ariel-data-challenge-2024/discussion/543686",
  "author_name": "Natan Labarrère",
  "post_date": "2024-11-01T01:07:03.914000",
  "votes": 16,
  "comment_count": 0,
  "views": 0,
  "content": "<p>Hi all,</p>\n<p>Sharing my solution for 11h place. In all, really interesting competition and I'm glad I devoted my time here. I've made the code public already but it's really messy so I'll share here a summary of what I did.</p>\n<p><strong>Preprocessing</strong><br>\nPretty much the basic plus some small additions that most have already done and posted here, I've just added a minor FTT filter which does a good job of removing the noise without much affect on the signal (though there is some). I also did not time bin.</p>\n<p><strong>Smoothing</strong><br>\nI used a combination of SavGol with moving averages, with minimize to find the best combination.</p>\n<p><strong>Solution - Mean Spectra</strong><br>\nFirst I calculate the mean spectra for each planet. The solution I used to detect the loss is quite simple but I think unique here as most followed Sergei's idea. I basically shift the signal by X amount in time and take the difference - the min/max are phase 1 and 2. With this I also get the start and end of the transition.<br>\nOne of the tricky things I got right only close to the end of the competition is how much to shift, because the transition time from out-of-transit to in transit vary with the loss, so I recalculate everything.<br>\nTaking the difference already solves a lot of the poly functions the signals are following, but not entirely, so I also fit some linears close to where I'm getting the min/max to get the tendency, and subtract that from the signal loss.</p>\n<p><strong>Solution - Individual Spectra</strong><br>\nTo calculate each individual loss I do the same thing but with each wavelength. The problem here is the noise on the sensor level. So first, I use some things from the mean spectra - min/max positions, shift.<br>\nSecond, I average the wavelength signal with the rest of the wavelengths using weights. The closer to the wavelength the higher the weight of the mean. I use a gaussian function to calculate the weights (the wavelength in question being the mean or center of the function).<br>\nNow some wavelengths or planet signals are more noisy, so the weight also considers that. The more noisy, the more I even out the weights so the individual wavelength comes closer to the mean.</p>\n<p><strong>Modelling</strong><br>\nI'm using no models and whatever I get from the indvidual spectra calculation is my prediction. I only make a slight ~1% correction for each star.</p>\n<p><strong>Sigma</strong><br>\nHere I had quite a nice idea which increased my score by around 3/100. The usual sigma per wavelength is basically, well, the RMSE for each wavelength. I used this same idea to customize a random forest to instead of taking the means of the trees, it takes the RMSE of the trees (which are predicting the absolute errors). As features I created some noise measures (std or oscillations in the SavGol) as well as some measures of inaccuracies in the calculation (such as the ratio of phase 1 and 2), or tricky stars (high difference between individual spectra). I also don't differentiate between wavelength and calculate them all together (it's a feature, actualy).</p>\n<p>So, all in all, that's it. Hopefully this is useful to someone.</p>\n<p>Here's the code: <a href=\"https://www.kaggle.com/code/natanlabarrere/ariel-submission-11th-place\" target=\"_blank\">https://www.kaggle.com/code/natanlabarrere/ariel-submission-11th-place</a></p>",
  "messages": [
    {
      "id": 3033287,
      "postDate": "2024-11-01T01:07:03.913Z",
      "content": "<p>Hi all,</p>\n<p>Sharing my solution for 11h place. In all, really interesting competition and I'm glad I devoted my time here. I've made the code public already but it's really messy so I'll share here a summary of what I did.</p>\n<p><strong>Preprocessing</strong><br>\nPretty much the basic plus some small additions that most have already done and posted here, I've just added a minor FTT filter which does a good job of removing the noise without much affect on the signal (though there is some). I also did not time bin.</p>\n<p><strong>Smoothing</strong><br>\nI used a combination of SavGol with moving averages, with minimize to find the best combination.</p>\n<p><strong>Solution - Mean Spectra</strong><br>\nFirst I calculate the mean spectra for each planet. The solution I used to detect the loss is quite simple but I think unique here as most followed Sergei's idea. I basically shift the signal by X amount in time and take the difference - the min/max are phase 1 and 2. With this I also get the start and end of the transition.<br>\nOne of the tricky things I got right only close to the end of the competition is how much to shift, because the transition time from out-of-transit to in transit vary with the loss, so I recalculate everything.<br>\nTaking the difference already solves a lot of the poly functions the signals are following, but not entirely, so I also fit some linears close to where I'm getting the min/max to get the tendency, and subtract that from the signal loss.</p>\n<p><strong>Solution - Individual Spectra</strong><br>\nTo calculate each individual loss I do the same thing but with each wavelength. The problem here is the noise on the sensor level. So first, I use some things from the mean spectra - min/max positions, shift.<br>\nSecond, I average the wavelength signal with the rest of the wavelengths using weights. The closer to the wavelength the higher the weight of the mean. I use a gaussian function to calculate the weights (the wavelength in question being the mean or center of the function).<br>\nNow some wavelengths or planet signals are more noisy, so the weight also considers that. The more noisy, the more I even out the weights so the individual wavelength comes closer to the mean.</p>\n<p><strong>Modelling</strong><br>\nI'm using no models and whatever I get from the indvidual spectra calculation is my prediction. I only make a slight ~1% correction for each star.</p>\n<p><strong>Sigma</strong><br>\nHere I had quite a nice idea which increased my score by around 3/100. The usual sigma per wavelength is basically, well, the RMSE for each wavelength. I used this same idea to customize a random forest to instead of taking the means of the trees, it takes the RMSE of the trees (which are predicting the absolute errors). As features I created some noise measures (std or oscillations in the SavGol) as well as some measures of inaccuracies in the calculation (such as the ratio of phase 1 and 2), or tricky stars (high difference between individual spectra). I also don't differentiate between wavelength and calculate them all together (it's a feature, actualy).</p>\n<p>So, all in all, that's it. Hopefully this is useful to someone.</p>\n<p>Here's the code: <a href=\"https://www.kaggle.com/code/natanlabarrere/ariel-submission-11th-place\" target=\"_blank\">https://www.kaggle.com/code/natanlabarrere/ariel-submission-11th-place</a></p>",
      "rawMarkdown": "Hi all,\n\nSharing my solution for 11h place. In all, really interesting competition and I'm glad I devoted my time here. I've made the code public already but it's really messy so I'll share here a summary of what I did.\n\n**Preprocessing**\nPretty much the basic plus some small additions that most have already done and posted here, I've just added a minor FTT filter which does a good job of removing the noise without much affect on the signal (though there is some). I also did not time bin.\n\n**Smoothing**\nI used a combination of SavGol with moving averages, with minimize to find the best combination.\n\n**Solution - Mean Spectra**\nFirst I calculate the mean spectra for each planet. The solution I used to detect the loss is quite simple but I think unique here as most followed Sergei's idea. I basically shift the signal by X amount in time and take the difference - the min/max are phase 1 and 2. With this I also get the start and end of the transition.\nOne of the tricky things I got right only close to the end of the competition is how much to shift, because the transition time from out-of-transit to in transit vary with the loss, so I recalculate everything.\nTaking the difference already solves a lot of the poly functions the signals are following, but not entirely, so I also fit some linears close to where I'm getting the min/max to get the tendency, and subtract that from the signal loss.\n\n**Solution - Individual Spectra**\nTo calculate each individual loss I do the same thing but with each wavelength. The problem here is the noise on the sensor level. So first, I use some things from the mean spectra - min/max positions, shift.\nSecond, I average the wavelength signal with the rest of the wavelengths using weights. The closer to the wavelength the higher the weight of the mean. I use a gaussian function to calculate the weights (the wavelength in question being the mean or center of the function).\nNow some wavelengths or planet signals are more noisy, so the weight also considers that. The more noisy, the more I even out the weights so the individual wavelength comes closer to the mean.\n\n**Modelling**\nI'm using no models and whatever I get from the indvidual spectra calculation is my prediction. I only make a slight ~1% correction for each star.\n\n**Sigma**\nHere I had quite a nice idea which increased my score by around 3/100. The usual sigma per wavelength is basically, well, the RMSE for each wavelength. I used this same idea to customize a random forest to instead of taking the means of the trees, it takes the RMSE of the trees (which are predicting the absolute errors). As features I created some noise measures (std or oscillations in the SavGol) as well as some measures of inaccuracies in the calculation (such as the ratio of phase 1 and 2), or tricky stars (high difference between individual spectra). I also don't differentiate between wavelength and calculate them all together (it's a feature, actualy).\n\nSo, all in all, that's it. Hopefully this is useful to someone.\n\nHere's the code: https://www.kaggle.com/code/natanlabarrere/ariel-submission-11th-place",
      "votes": 16
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "3033287": "Hi all,\n\nSharing my solution for 11h place. In all, really interesting competition and I'm glad I devoted my time here. I've made the code public already but it's really messy so I'll share here a summary of what I did.\n\n**Preprocessing**\nPretty much the basic plus some small additions that most have already done and posted here, I've just added a minor FTT filter which does a good job of removing the noise without much affect on the signal (though there is some). I also did not time bin.\n\n**Smoothing**\nI used a combination of SavGol with moving averages, with minimize to find the best combination.\n\n**Solution - Mean Spectra**\nFirst I calculate the mean spectra for each planet. The solution I used to detect the loss is quite simple but I think unique here as most followed Sergei's idea. I basically shift the signal by X amount in time and take the difference - the min/max are phase 1 and 2. With this I also get the start and end of the transition.\nOne of the tricky things I got right only close to the end of the competition is how much to shift, because the transition time from out-of-transit to in transit vary with the loss, so I recalculate everything.\nTaking the difference already solves a lot of the poly functions the signals are following, but not entirely, so I also fit some linears close to where I'm getting the min/max to get the tendency, and subtract that from the signal loss.\n\n**Solution - Individual Spectra**\nTo calculate each individual loss I do the same thing but with each wavelength. The problem here is the noise on the sensor level. So first, I use some things from the mean spectra - min/max positions, shift.\nSecond, I average the wavelength signal with the rest of the wavelengths using weights. The closer to the wavelength the higher the weight of the mean. I use a gaussian function to calculate the weights (the wavelength in question being the mean or center of the function).\nNow some wavelengths or planet signals are more noisy, so the weight also considers that. The more noisy, the more I even out the weights so the individual wavelength comes closer to the mean.\n\n**Modelling**\nI'm using no models and whatever I get from the indvidual spectra calculation is my prediction. I only make a slight ~1% correction for each star.\n\n**Sigma**\nHere I had quite a nice idea which increased my score by around 3/100. The usual sigma per wavelength is basically, well, the RMSE for each wavelength. I used this same idea to customize a random forest to instead of taking the means of the trees, it takes the RMSE of the trees (which are predicting the absolute errors). As features I created some noise measures (std or oscillations in the SavGol) as well as some measures of inaccuracies in the calculation (such as the ratio of phase 1 and 2), or tricky stars (high difference between individual spectra). I also don't differentiate between wavelength and calculate them all together (it's a feature, actualy).\n\nSo, all in all, that's it. Hopefully this is useful to someone.\n\nHere's the code: https://www.kaggle.com/code/natanlabarrere/ariel-submission-11th-place"
  }
}