{
  "id": 544189,
  "title": "10th Place Solution",
  "url": "/competitions/ariel-data-challenge-2024/discussion/544189",
  "author_name": "Georgii Aparin",
  "post_date": "2024-11-03T19:25:12.592000",
  "votes": 19,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Thanks to the participants and organizers for this competition. It was very interesting and educational. I hope to see Ariel on kaggle in a year.</p>\n<h2>Approach</h2>\n<p>We used a polynomial approximation approach. Thanks a lot to Sergey for sharing. The main difference of our approach was the use of the entire signal, without cutting out the moments of entry/exit into/from the transit. You can check all the code at this <a href=\"https://www.kaggle.com/code/egorgij21/ariel-final-top10\" target=\"_blank\">notebook link</a>.</p>\n<h2>Transit zone detection</h2>\n<p>The transit phase detection algorithm analyzes the time series of the signal, calculating derivatives in a sliding window to identify sudden changes in light intensity characteristic of the planet entering and exiting the transit state.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2F4a3e0b5cc29cb1f07c2efd5363554b2f%2FScreenshot%202024-11-03%20at%2021.41.44.png?generation=1730659498731754&amp;alt=media\" alt=\"\"><br>\nBased on the extrema of the derivative, the midpoints of the first and second phases of transit are determined. To clarify the beginning of the first phase, the signal is divided into two linear sections with error minimization, which makes it possible to accurately determine the beginning of the transit. In total, the algorithm returns the entry/exit indices and the duration of the transition to/from transit.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2F9ac838f19de4ca7ce6d0556a7ce6474c%2FScreenshot%202024-11-03%20at%2021.43.44.png?generation=1730659513349326&amp;alt=media\" alt=\"\"></p>\n<h2>Function for transit recovery</h2>\n<p>Having no idea about the general format of a function, multiplication by which could model transit, we chose <a href=\"https://www.desmos.com/calculator/iipeyednvz\" target=\"_blank\">function</a>, which being smooth could approximate the piecewise real one quite well. Further using the UNIFORM format did not lead to an increase in the score, we decided to keep the smooth version.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2Fa971a6d8405491555166cf13a75d887b%2FScreenshot%202024-11-03%20at%2021.23.23.png?generation=1730659125819697&amp;alt=media\" alt=\"\"><br>\nTransit correction example:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2F03eb1a8bc41d4c3134d8d1ce8490f5fa%2FScreenshot%202024-11-03%20at%2021.39.58.png?generation=1730659247377258&amp;alt=media\" alt=\"\"></p>\n<h2>Prediction Collection Pipeline</h2>\n<p>Our main pipeline calculates the target by performing wavelength binning aggregation and selecting random sample indices.</p>\n<p>Steps:<br>\n1) <strong>Calculate Parameters</strong>: We calculate the parameters <code>p1</code>, <code>p2</code>, and <code>t</code>, representing the start of transit, end of transit, and duration of transition to transit, respectively.<br>\n2) <strong>Compute d_st and Polynomial on Normalized Signal</strong>: We calculate <code>d_st</code>, which represents the mean prediction of the target (denoted as \"d\" in our code). At this step, we also optimize other parameters obtained in the first step.<br>\n3) <strong>Iterate Over Wavelength Indices</strong>: Using a moving window of size <code>2 * k_binn_wl</code> and a step of <code>k_binn_wl // 2</code>, we iterate over wavelength indices.<br>\n4) <strong>Optimize Polynomials on Subsamples</strong>: Within each window, we optimize 15 polynomials on subsamples of randomly selected wavelengths from the current window. For each subsample, we select <code>k_binn_wl</code> wavelengths.<br>\n5) <strong>Break Down Subsamples</strong>: Each subsample is further divided into smaller wavelength index groups, and we optimize only the target on their averaged signals.<br>\n6) <strong>Calculate Predictions for Noised Wavelengths</strong>: Finally, we calculate predictions for noisy wavelengths using the same algorithm, but without the first <code>k_binn_wl</code> iterations.</p>\n<pre><code>p1, p2, t = phase_detector(normalized_planet[:, :-].(axis=))\n\nt_st, d_st, p1_st, p2_st, poly, deg = calibrate_train_poly(normalized_planet[:, :-].(axis=), p1, p2, t, x)\n\n k  (, , k_binn_wl // ):\n     j  ():\n         = .(..choice(.arange((k - k_binn_wl, ), (k + k_binn_wl, )), k_binn_wl, replace=False))\n\n        signal = normalized_planet[:, ].(axis=)\n\n        t_st_j, d_st_j, p1_j, p2_j, poly_j,  = calibrate_train_poly(signal, p1_st, p2_st, t_st, x, d_st=d_st, best_deg=deg)\n\n        binn_j =  * (k //  + )\n         w_idxs  .reshape((.shape[] // binn_j, binn_j)):\n            signal = normalized_planet[:, w_idxs].(axis=)\n            d = calibrate_train(signal, p1_j, p2_j, t_st_j, poly_j, d_st_j, x, =)\n             w_idx_i  w_idxs:\n                planet_d[w_idx_i].(d)\n\n j  ():\n     = .(..choice(.arange(), , replace=False))\n    signal = normalized_planet[:, ].(axis=)\n    t_st_j, d_st_j, p1_j, p2_j, poly_j,  = calibrate_train_poly(signal, p1_st, p2_st, t_st, x, d_st=d_st, best_deg=deg)\n\n     w_idx  .reshape((, .shape[] // )):\n        signal = normalized_planet[:, w_idx].(axis=)\n        d = calibrate_train(signal, p1_j, p2_j, t_st_j, poly_j, d_st_j, x, =)\n         w_idx_i  w_idx:\n             w_idx_i &lt;= :\n                planet_d[w_idx_i].(d)\n</code></pre>\n<p>For better understanding, you can check the scheme:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2Fb0a2c1304769ef8dd052f7b42d439d09%2FScreenshot%202024-11-03%20at%2021.12.52.png?generation=1730657688281945&amp;alt=media\" alt=\"\"><br>\nAlso for best score we used blending with various k_binn_wl parameter. As it decreases, the noise in the prediction increases, but sometimes the accuracy increases, since it is responsible for the length of the window from which the polynomial of a randomly taken sample will be calculated.</p>\n<h2>Sigma estimation</h2>\n<p>To estimate sigma, we used an ensemble of gradient boostings, which was trained on prediction features. We predicted 2 values ​​for each planet one for \"good\" wavelengths and one for \"noisy\" ones. Training was carried out on features from the predictions of one star, and validation on features from the another. BTW good sigma prediction boosted our public score on 0.04 points.</p>\n<h2>Results</h2>\n<p>mean RMSE on train = 4.58e-5<br>\nmean RMSE on train for case \"the average against all wavelengths\" = 5.75e-5</p>\n<h2>What didn't work for us</h2>\n<p>1) <strong>Post pred normaliztion</strong>: We had planned to normalise the polynomials describing the flux after obtaining the pre-transit coefficients so that the subsampling would make more physical sense, but the score for unknown reasons did not increase.<br>\n2) <strong>2D Polynoms</strong>: We tried to construct two-dimensional polynomials describing the whole normalised flux, but we could not devote enough time to this approach.</p>",
  "messages": [
    {
      "id": 3035704,
      "postDate": "2024-11-03T19:25:12.593Z",
      "content": "<p>Thanks to the participants and organizers for this competition. It was very interesting and educational. I hope to see Ariel on kaggle in a year.</p>\n<h2>Approach</h2>\n<p>We used a polynomial approximation approach. Thanks a lot to Sergey for sharing. The main difference of our approach was the use of the entire signal, without cutting out the moments of entry/exit into/from the transit. You can check all the code at this <a href=\"https://www.kaggle.com/code/egorgij21/ariel-final-top10\" target=\"_blank\">notebook link</a>.</p>\n<h2>Transit zone detection</h2>\n<p>The transit phase detection algorithm analyzes the time series of the signal, calculating derivatives in a sliding window to identify sudden changes in light intensity characteristic of the planet entering and exiting the transit state.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2F4a3e0b5cc29cb1f07c2efd5363554b2f%2FScreenshot%202024-11-03%20at%2021.41.44.png?generation=1730659498731754&amp;alt=media\" alt=\"\"><br>\nBased on the extrema of the derivative, the midpoints of the first and second phases of transit are determined. To clarify the beginning of the first phase, the signal is divided into two linear sections with error minimization, which makes it possible to accurately determine the beginning of the transit. In total, the algorithm returns the entry/exit indices and the duration of the transition to/from transit.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2F9ac838f19de4ca7ce6d0556a7ce6474c%2FScreenshot%202024-11-03%20at%2021.43.44.png?generation=1730659513349326&amp;alt=media\" alt=\"\"></p>\n<h2>Function for transit recovery</h2>\n<p>Having no idea about the general format of a function, multiplication by which could model transit, we chose <a href=\"https://www.desmos.com/calculator/iipeyednvz\" target=\"_blank\">function</a>, which being smooth could approximate the piecewise real one quite well. Further using the UNIFORM format did not lead to an increase in the score, we decided to keep the smooth version.<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2Fa971a6d8405491555166cf13a75d887b%2FScreenshot%202024-11-03%20at%2021.23.23.png?generation=1730659125819697&amp;alt=media\" alt=\"\"><br>\nTransit correction example:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2F03eb1a8bc41d4c3134d8d1ce8490f5fa%2FScreenshot%202024-11-03%20at%2021.39.58.png?generation=1730659247377258&amp;alt=media\" alt=\"\"></p>\n<h2>Prediction Collection Pipeline</h2>\n<p>Our main pipeline calculates the target by performing wavelength binning aggregation and selecting random sample indices.</p>\n<p>Steps:<br>\n1) <strong>Calculate Parameters</strong>: We calculate the parameters <code>p1</code>, <code>p2</code>, and <code>t</code>, representing the start of transit, end of transit, and duration of transition to transit, respectively.<br>\n2) <strong>Compute d_st and Polynomial on Normalized Signal</strong>: We calculate <code>d_st</code>, which represents the mean prediction of the target (denoted as \"d\" in our code). At this step, we also optimize other parameters obtained in the first step.<br>\n3) <strong>Iterate Over Wavelength Indices</strong>: Using a moving window of size <code>2 * k_binn_wl</code> and a step of <code>k_binn_wl // 2</code>, we iterate over wavelength indices.<br>\n4) <strong>Optimize Polynomials on Subsamples</strong>: Within each window, we optimize 15 polynomials on subsamples of randomly selected wavelengths from the current window. For each subsample, we select <code>k_binn_wl</code> wavelengths.<br>\n5) <strong>Break Down Subsamples</strong>: Each subsample is further divided into smaller wavelength index groups, and we optimize only the target on their averaged signals.<br>\n6) <strong>Calculate Predictions for Noised Wavelengths</strong>: Finally, we calculate predictions for noisy wavelengths using the same algorithm, but without the first <code>k_binn_wl</code> iterations.</p>\n<pre><code>p1, p2, t = phase_detector(normalized_planet[:, :-].(axis=))\n\nt_st, d_st, p1_st, p2_st, poly, deg = calibrate_train_poly(normalized_planet[:, :-].(axis=), p1, p2, t, x)\n\n k  (, , k_binn_wl // ):\n     j  ():\n         = .(..choice(.arange((k - k_binn_wl, ), (k + k_binn_wl, )), k_binn_wl, replace=False))\n\n        signal = normalized_planet[:, ].(axis=)\n\n        t_st_j, d_st_j, p1_j, p2_j, poly_j,  = calibrate_train_poly(signal, p1_st, p2_st, t_st, x, d_st=d_st, best_deg=deg)\n\n        binn_j =  * (k //  + )\n         w_idxs  .reshape((.shape[] // binn_j, binn_j)):\n            signal = normalized_planet[:, w_idxs].(axis=)\n            d = calibrate_train(signal, p1_j, p2_j, t_st_j, poly_j, d_st_j, x, =)\n             w_idx_i  w_idxs:\n                planet_d[w_idx_i].(d)\n\n j  ():\n     = .(..choice(.arange(), , replace=False))\n    signal = normalized_planet[:, ].(axis=)\n    t_st_j, d_st_j, p1_j, p2_j, poly_j,  = calibrate_train_poly(signal, p1_st, p2_st, t_st, x, d_st=d_st, best_deg=deg)\n\n     w_idx  .reshape((, .shape[] // )):\n        signal = normalized_planet[:, w_idx].(axis=)\n        d = calibrate_train(signal, p1_j, p2_j, t_st_j, poly_j, d_st_j, x, =)\n         w_idx_i  w_idx:\n             w_idx_i &lt;= :\n                planet_d[w_idx_i].(d)\n</code></pre>\n<p>For better understanding, you can check the scheme:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2Fb0a2c1304769ef8dd052f7b42d439d09%2FScreenshot%202024-11-03%20at%2021.12.52.png?generation=1730657688281945&amp;alt=media\" alt=\"\"><br>\nAlso for best score we used blending with various k_binn_wl parameter. As it decreases, the noise in the prediction increases, but sometimes the accuracy increases, since it is responsible for the length of the window from which the polynomial of a randomly taken sample will be calculated.</p>\n<h2>Sigma estimation</h2>\n<p>To estimate sigma, we used an ensemble of gradient boostings, which was trained on prediction features. We predicted 2 values ​​for each planet one for \"good\" wavelengths and one for \"noisy\" ones. Training was carried out on features from the predictions of one star, and validation on features from the another. BTW good sigma prediction boosted our public score on 0.04 points.</p>\n<h2>Results</h2>\n<p>mean RMSE on train = 4.58e-5<br>\nmean RMSE on train for case \"the average against all wavelengths\" = 5.75e-5</p>\n<h2>What didn't work for us</h2>\n<p>1) <strong>Post pred normaliztion</strong>: We had planned to normalise the polynomials describing the flux after obtaining the pre-transit coefficients so that the subsampling would make more physical sense, but the score for unknown reasons did not increase.<br>\n2) <strong>2D Polynoms</strong>: We tried to construct two-dimensional polynomials describing the whole normalised flux, but we could not devote enough time to this approach.</p>",
      "rawMarkdown": "Thanks to the participants and organizers for this competition. It was very interesting and educational. I hope to see Ariel on kaggle in a year.\n\n## Approach\nWe used a polynomial approximation approach. Thanks a lot to Sergey for sharing. The main difference of our approach was the use of the entire signal, without cutting out the moments of entry/exit into/from the transit. You can check all the code at this [notebook link](https://www.kaggle.com/code/egorgij21/ariel-final-top10).\n\n## Transit zone detection\nThe transit phase detection algorithm analyzes the time series of the signal, calculating derivatives in a sliding window to identify sudden changes in light intensity characteristic of the planet entering and exiting the transit state.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2F4a3e0b5cc29cb1f07c2efd5363554b2f%2FScreenshot%202024-11-03%20at%2021.41.44.png?generation=1730659498731754&alt=media)\nBased on the extrema of the derivative, the midpoints of the first and second phases of transit are determined. To clarify the beginning of the first phase, the signal is divided into two linear sections with error minimization, which makes it possible to accurately determine the beginning of the transit. In total, the algorithm returns the entry/exit indices and the duration of the transition to/from transit.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2F9ac838f19de4ca7ce6d0556a7ce6474c%2FScreenshot%202024-11-03%20at%2021.43.44.png?generation=1730659513349326&alt=media)\n\n## Function for transit recovery\nHaving no idea about the general format of a function, multiplication by which could model transit, we chose [function](https://www.desmos.com/calculator/iipeyednvz), which being smooth could approximate the piecewise real one quite well. Further using the UNIFORM format did not lead to an increase in the score, we decided to keep the smooth version.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2Fa971a6d8405491555166cf13a75d887b%2FScreenshot%202024-11-03%20at%2021.23.23.png?generation=1730659125819697&alt=media)\nTransit correction example:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2F03eb1a8bc41d4c3134d8d1ce8490f5fa%2FScreenshot%202024-11-03%20at%2021.39.58.png?generation=1730659247377258&alt=media)\n\n## Prediction Collection Pipeline\nOur main pipeline calculates the target by performing wavelength binning aggregation and selecting random sample indices.\n\nSteps:\n1) **Calculate Parameters**: We calculate the parameters `p1`, `p2`, and `t`, representing the start of transit, end of transit, and duration of transition to transit, respectively.\n2) **Compute d_st and Polynomial on Normalized Signal**: We calculate `d_st`, which represents the mean prediction of the target (denoted as \"d\" in our code). At this step, we also optimize other parameters obtained in the first step.\n3) **Iterate Over Wavelength Indices**: Using a moving window of size `2 * k_binn_wl` and a step of `k_binn_wl // 2`, we iterate over wavelength indices.\n4) **Optimize Polynomials on Subsamples**: Within each window, we optimize 15 polynomials on subsamples of randomly selected wavelengths from the current window. For each subsample, we select `k_binn_wl` wavelengths.\n5) **Break Down Subsamples**: Each subsample is further divided into smaller wavelength index groups, and we optimize only the target on their averaged signals.\n6) **Calculate Predictions for Noised Wavelengths**: Finally, we calculate predictions for noisy wavelengths using the same algorithm, but without the first `k_binn_wl` iterations.\n```\np1, p2, t = phase_detector(normalized_planet[:, :-1].mean(axis=1))\n\nt_st, d_st, p1_st, p2_st, poly, deg = calibrate_train_poly(normalized_planet[:, :-1].mean(axis=1), p1, p2, t, x)\n\nfor k in range(100, 283, k_binn_wl // 2):\n    for j in range(15):\n        subsample = np.sort(np.random.choice(np.arange(max(k - k_binn_wl, 0), min(k + k_binn_wl, 283)), k_binn_wl, replace=False))\n\n        signal = normalized_planet[:, subsample].mean(axis=1)\n\n        t_st_j, d_st_j, p1_j, p2_j, poly_j, _ = calibrate_train_poly(signal, p1_st, p2_st, t_st, x, d_st=d_st, best_deg=deg)\n\n        binn_j = 5 * (k // 100 + 1)\n        for w_idxs in subsample.reshape((subsample.shape[0] // binn_j, binn_j)):\n            signal = normalized_planet[:, w_idxs].mean(axis=1)\n            d = calibrate_train(signal, p1_j, p2_j, t_st_j, poly_j, d_st_j, x, method=\"Nelder-Mead\")\n            for w_idx_i in w_idxs:\n                planet_d[w_idx_i].append(d)\n\nfor j in range(100):\n    subsample = np.sort(np.random.choice(np.arange(283), 100, replace=False))\n    signal = normalized_planet[:, subsample].mean(axis=1)\n    t_st_j, d_st_j, p1_j, p2_j, poly_j, _ = calibrate_train_poly(signal, p1_st, p2_st, t_st, x, d_st=d_st, best_deg=deg)\n\n    for w_idx in subsample.reshape((10, subsample.shape[0] // 10)):\n        signal = normalized_planet[:, w_idx].mean(axis=1)\n        d = calibrate_train(signal, p1_j, p2_j, t_st_j, poly_j, d_st_j, x, method=\"Nelder-Mead\")\n        for w_idx_i in w_idx:\n            if w_idx_i <= 100:\n                planet_d[w_idx_i].append(d)\n```\nFor better understanding, you can check the scheme:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2Fb0a2c1304769ef8dd052f7b42d439d09%2FScreenshot%202024-11-03%20at%2021.12.52.png?generation=1730657688281945&alt=media)\nAlso for best score we used blending with various k_binn_wl parameter. As it decreases, the noise in the prediction increases, but sometimes the accuracy increases, since it is responsible for the length of the window from which the polynomial of a randomly taken sample will be calculated.\n\n## Sigma estimation\nTo estimate sigma, we used an ensemble of gradient boostings, which was trained on prediction features. We predicted 2 values ​​for each planet one for \"good\" wavelengths and one for \"noisy\" ones. Training was carried out on features from the predictions of one star, and validation on features from the another. BTW good sigma prediction boosted our public score on 0.04 points.\n\n## Results\nmean RMSE on train = 4.58e-5\nmean RMSE on train for case \"the average against all wavelengths\" = 5.75e-5\n\n## What didn't work for us\n1) **Post pred normaliztion**: We had planned to normalise the polynomials describing the flux after obtaining the pre-transit coefficients so that the subsampling would make more physical sense, but the score for unknown reasons did not increase.\n2) **2D Polynoms**: We tried to construct two-dimensional polynomials describing the whole normalised flux, but we could not devote enough time to this approach.\n",
      "votes": 19
    },
    {
      "id": 3035757,
      "postDate": "2024-11-03T20:23:04.603Z",
      "content": "<p>Congratz on gold. I remember that at the begining you were at the top, then you became stuck in silver range for a long time and finaly gave a strong push in tha last week or so. What was this final 'enlightenment'?</p>",
      "rawMarkdown": "Congratz on gold. I remember that at the begining you were at the top, then you became stuck in silver range for a long time and finaly gave a strong push in tha last week or so. What was this final 'enlightenment'?",
      "votes": 1,
      "replies": [
        {
          "id": 3035772,
          "postDate": "2024-11-03T20:40:43.630Z",
          "content": "<p>Thanks! Yeah, I was stuck for a month, had no ideas, went to the mountains for rest… I didn't believe in the possibility of reaching gold. In the last week Vitaly joined us and we decided to take the competition seriously again. The joke is that the basic algorithm for achieving high results has not changed. Blending the algorithm with different starting parameters and blending boostings to estimate sigmas helped jump from 0.628 to 0.670+</p>",
          "rawMarkdown": "Thanks! Yeah, I was stuck for a month, had no ideas, went to the mountains for rest... I didn't believe in the possibility of reaching gold. In the last week Vitaly joined us and we decided to take the competition seriously again. The joke is that the basic algorithm for achieving high results has not changed. Blending the algorithm with different starting parameters and blending boostings to estimate sigmas helped jump from 0.628 to 0.670+",
          "votes": 2,
          "replies": [
            {
              "id": 3036555,
              "postDate": "2024-11-04T17:14:58.393Z",
              "content": "<p>so, mountains did the thing</p>",
              "rawMarkdown": " so, mountains did the thing",
              "votes": 1
            }
          ]
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 3035757,
      "author_name": "greySnow",
      "author_url": "",
      "post_date": "2024-11-03T20:23:04.603000",
      "content": "<p>Congratz on gold. I remember that at the begining you were at the top, then you became stuck in silver range for a long time and finaly gave a strong push in tha last week or so. What was this final 'enlightenment'?</p>",
      "votes": 1,
      "replies": [
        {
          "id": 3035772,
          "author_name": "Georgii Aparin",
          "author_url": "",
          "post_date": "2024-11-03T20:40:43.630000",
          "content": "<p>Thanks! Yeah, I was stuck for a month, had no ideas, went to the mountains for rest… I didn't believe in the possibility of reaching gold. In the last week Vitaly joined us and we decided to take the competition seriously again. The joke is that the basic algorithm for achieving high results has not changed. Blending the algorithm with different starting parameters and blending boostings to estimate sigmas helped jump from 0.628 to 0.670+</p>",
          "votes": 2,
          "replies": [
            {
              "id": 3036555,
              "author_name": "sapfear",
              "author_url": "",
              "post_date": "2024-11-04T17:14:58.393000",
              "content": "<p>so, mountains did the thing</p>",
              "votes": 1,
              "replies": []
            }
          ]
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "3035704": "Thanks to the participants and organizers for this competition. It was very interesting and educational. I hope to see Ariel on kaggle in a year.\n\n## Approach\nWe used a polynomial approximation approach. Thanks a lot to Sergey for sharing. The main difference of our approach was the use of the entire signal, without cutting out the moments of entry/exit into/from the transit. You can check all the code at this [notebook link](https://www.kaggle.com/code/egorgij21/ariel-final-top10).\n\n## Transit zone detection\nThe transit phase detection algorithm analyzes the time series of the signal, calculating derivatives in a sliding window to identify sudden changes in light intensity characteristic of the planet entering and exiting the transit state.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2F4a3e0b5cc29cb1f07c2efd5363554b2f%2FScreenshot%202024-11-03%20at%2021.41.44.png?generation=1730659498731754&alt=media)\nBased on the extrema of the derivative, the midpoints of the first and second phases of transit are determined. To clarify the beginning of the first phase, the signal is divided into two linear sections with error minimization, which makes it possible to accurately determine the beginning of the transit. In total, the algorithm returns the entry/exit indices and the duration of the transition to/from transit.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2F9ac838f19de4ca7ce6d0556a7ce6474c%2FScreenshot%202024-11-03%20at%2021.43.44.png?generation=1730659513349326&alt=media)\n\n## Function for transit recovery\nHaving no idea about the general format of a function, multiplication by which could model transit, we chose [function](https://www.desmos.com/calculator/iipeyednvz), which being smooth could approximate the piecewise real one quite well. Further using the UNIFORM format did not lead to an increase in the score, we decided to keep the smooth version.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2Fa971a6d8405491555166cf13a75d887b%2FScreenshot%202024-11-03%20at%2021.23.23.png?generation=1730659125819697&alt=media)\nTransit correction example:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2F03eb1a8bc41d4c3134d8d1ce8490f5fa%2FScreenshot%202024-11-03%20at%2021.39.58.png?generation=1730659247377258&alt=media)\n\n## Prediction Collection Pipeline\nOur main pipeline calculates the target by performing wavelength binning aggregation and selecting random sample indices.\n\nSteps:\n1) **Calculate Parameters**: We calculate the parameters `p1`, `p2`, and `t`, representing the start of transit, end of transit, and duration of transition to transit, respectively.\n2) **Compute d_st and Polynomial on Normalized Signal**: We calculate `d_st`, which represents the mean prediction of the target (denoted as \"d\" in our code). At this step, we also optimize other parameters obtained in the first step.\n3) **Iterate Over Wavelength Indices**: Using a moving window of size `2 * k_binn_wl` and a step of `k_binn_wl // 2`, we iterate over wavelength indices.\n4) **Optimize Polynomials on Subsamples**: Within each window, we optimize 15 polynomials on subsamples of randomly selected wavelengths from the current window. For each subsample, we select `k_binn_wl` wavelengths.\n5) **Break Down Subsamples**: Each subsample is further divided into smaller wavelength index groups, and we optimize only the target on their averaged signals.\n6) **Calculate Predictions for Noised Wavelengths**: Finally, we calculate predictions for noisy wavelengths using the same algorithm, but without the first `k_binn_wl` iterations.\n```\np1, p2, t = phase_detector(normalized_planet[:, :-1].mean(axis=1))\n\nt_st, d_st, p1_st, p2_st, poly, deg = calibrate_train_poly(normalized_planet[:, :-1].mean(axis=1), p1, p2, t, x)\n\nfor k in range(100, 283, k_binn_wl // 2):\n    for j in range(15):\n        subsample = np.sort(np.random.choice(np.arange(max(k - k_binn_wl, 0), min(k + k_binn_wl, 283)), k_binn_wl, replace=False))\n\n        signal = normalized_planet[:, subsample].mean(axis=1)\n\n        t_st_j, d_st_j, p1_j, p2_j, poly_j, _ = calibrate_train_poly(signal, p1_st, p2_st, t_st, x, d_st=d_st, best_deg=deg)\n\n        binn_j = 5 * (k // 100 + 1)\n        for w_idxs in subsample.reshape((subsample.shape[0] // binn_j, binn_j)):\n            signal = normalized_planet[:, w_idxs].mean(axis=1)\n            d = calibrate_train(signal, p1_j, p2_j, t_st_j, poly_j, d_st_j, x, method=\"Nelder-Mead\")\n            for w_idx_i in w_idxs:\n                planet_d[w_idx_i].append(d)\n\nfor j in range(100):\n    subsample = np.sort(np.random.choice(np.arange(283), 100, replace=False))\n    signal = normalized_planet[:, subsample].mean(axis=1)\n    t_st_j, d_st_j, p1_j, p2_j, poly_j, _ = calibrate_train_poly(signal, p1_st, p2_st, t_st, x, d_st=d_st, best_deg=deg)\n\n    for w_idx in subsample.reshape((10, subsample.shape[0] // 10)):\n        signal = normalized_planet[:, w_idx].mean(axis=1)\n        d = calibrate_train(signal, p1_j, p2_j, t_st_j, poly_j, d_st_j, x, method=\"Nelder-Mead\")\n        for w_idx_i in w_idx:\n            if w_idx_i <= 100:\n                planet_d[w_idx_i].append(d)\n```\nFor better understanding, you can check the scheme:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F11837581%2Fb0a2c1304769ef8dd052f7b42d439d09%2FScreenshot%202024-11-03%20at%2021.12.52.png?generation=1730657688281945&alt=media)\nAlso for best score we used blending with various k_binn_wl parameter. As it decreases, the noise in the prediction increases, but sometimes the accuracy increases, since it is responsible for the length of the window from which the polynomial of a randomly taken sample will be calculated.\n\n## Sigma estimation\nTo estimate sigma, we used an ensemble of gradient boostings, which was trained on prediction features. We predicted 2 values ​​for each planet one for \"good\" wavelengths and one for \"noisy\" ones. Training was carried out on features from the predictions of one star, and validation on features from the another. BTW good sigma prediction boosted our public score on 0.04 points.\n\n## Results\nmean RMSE on train = 4.58e-5\nmean RMSE on train for case \"the average against all wavelengths\" = 5.75e-5\n\n## What didn't work for us\n1) **Post pred normaliztion**: We had planned to normalise the polynomials describing the flux after obtaining the pre-transit coefficients so that the subsampling would make more physical sense, but the score for unknown reasons did not increase.\n2) **2D Polynoms**: We tried to construct two-dimensional polynomials describing the whole normalised flux, but we could not devote enough time to this approach.\n",
    "3035757": "Congratz on gold. I remember that at the begining you were at the top, then you became stuck in silver range for a long time and finaly gave a strong push in tha last week or so. What was this final 'enlightenment'?"
  }
}