{
  "id": 609482,
  "title": "37th Solution",
  "url": "/competitions/ariel-data-challenge-2025/discussion/609482",
  "author_name": "ihiratch",
  "post_date": "2025-09-27T03:23:21.578000",
  "votes": 6,
  "comment_count": 2,
  "views": 0,
  "content": "<h2>Introduction</h2>\n<p>We ( <a href=\"https://www.kaggle.com/ihiratch\" target=\"_blank\">@ihiratch</a>, <a href=\"https://www.kaggle.com/prgckwb\" target=\"_blank\">@prgckwb</a>, <a href=\"https://www.kaggle.com/itachicom615\" target=\"_blank\">@itachicom615</a>, <a href=\"https://www.kaggle.com/nashisandesu\" target=\"_blank\">@nashisandesu</a>) would like to express our gratitude to the competition organizers.  It was a really fun and insightful challenge, and we look forward to participating again. <br>\n<br><br>\nOur approach consists of the following steps:</p>\n<ul>\n<li>Preprocessing</li>\n<li>Transit phase detection</li>\n<li>Transit depth estimation</li>\n<li>Sigma estimation</li>\n<li>Postprocessing</li>\n<li>Ensembling</li>\n</ul>\n<p>We mainly used mathematical modeling instead of machine learning approach.  Our predictions focused on the average transit depth and sigma values.  We did not use wavelength-dependent predictions for either transit depth or sigma.  </p>\n<h2>Preprocessing</h2>\n<p>For preprocessing, we relied on this excellent public notebook<br>\n( <a href=\"https://www.kaggle.com/code/vitalykudelya/neurips-non-ml-transit-curve-fitting\" target=\"_blank\">https://www.kaggle.com/code/vitalykudelya/neurips-non-ml-transit-curve-fitting</a> ). We are very grateful to <a href=\"https://www.kaggle.com/vitalykudelya\" target=\"_blank\">@vitalykudelya</a> for sharing it.<br>\nThe main modification we made was accelerating the linearity correction step with Numba.  This reduced the preprocessing time from about 6 hours to roughly 2 hours.  </p>\n<h2>Transit Phase Detection</h2>\n<p>We detected the transit phase using the white light curve (i.e., the light curve averaged over all wavelengths).  </p>\n<h3>Method Overview</h3>\n<p>We approximate the ingress and egress regions with straight lines.  The boundaries (ingress start, ingress end, egress start, egress end) can be estimated at the points where the white light curve begins to deviate from these lines (see the figure below).<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F13731448%2Ff68b64aaf455ef45880a535f63ebc7a7%2Ftransit_detection.png?generation=1758952453670141&amp;alt=media\" alt=\"\"></p>\n<h3>Details</h3>\n<ul>\n<li>We first obtain the indices corresponding to the maximum and minimum values of differences of the white light curve.  </li>\n<li>The minimum difference roughly corresponds to the middle of the ingress transition.  </li>\n<li>The maximum difference roughly corresponds to the middle of the egress transition.  </li>\n<li>Around these indices, we construct local linear fits (“local lines”).  </li>\n<li>We then calculate the residuals between the local lines and the white light curve.  </li>\n<li>The points where the residuals started to deviate from zero are taken as the transit phase boundaries.  We detect a deviation when the residual exceeds <code>std(white light curve) × THRESH_RATIO</code> (a hyperparameter). </li>\n</ul>\n<h2>Transit Depth Estimation</h2>\n<p>We predicted the average transit depth for each planet using a mathematical model. The model was a simplified version of last year’s first-place mathematical model. ( <a href=\"https://www.kaggle.com/competitions/ariel-data-challenge-2024/writeups/c-number-daiwakun-1st-place-solution\" target=\"_blank\">https://www.kaggle.com/competitions/ariel-data-challenge-2024/writeups/c-number-daiwakun-1st-place-solution</a> ) Many thanks to <a href=\"https://www.kaggle.com/cnumber\" target=\"_blank\">@cnumber</a> and <a href=\"https://www.kaggle.com/daiwakun\" target=\"_blank\">@daiwakun</a> for sharing their excellent solution!<br>\nThe idea is to lift the in-transit (IT) flux so that it smoothly connects with the out-of-transit (OOT) flux through fitting.  The prediction is made for the <strong>average transit depth per planet</strong>.  We did not predict wavelength-dependent transit depths (we tried, but performance degraded).  <br>\n<br><br>\nModel: <br>\n$$<br>\ny(t) = s \\,(1 + d(t)), \\quad t \\in \\text{OOT}<br>\n$$<br>\n$$<br>\ny(t) = r \\cdot s \\,(1 + d(t)), \\quad t \\in \\text{IT}<br>\n$$<br>\nOptimization:<br>\n$$<br>\n\\min_{s,\\,r,\\,d} \\;\\;<br>\n\\sum_{t \\in \\mathrm{IT}} \\frac{1}{n_{\\mathrm{it}}}\\,\\bigl(y_{\\text{true}}(t)-y(t)\\bigr)^2<br>\n\\;+\\;<br>\n\\sum_{t \\in \\mathrm{OOT}} \\frac{1}{n_{\\mathrm{oot}}}\\,\\bigl(y_{\\text{true}}(t)-y(t)\\bigr)^2<br>\n\\quad<br>\n\\text{s.t.} \\quad <br>\n\\frac{1}{\\,n_{\\mathrm{it}}+n_{\\mathrm{oot}}\\,}\\sum_{t} d(t) = 0<br>\n$$<br>\nHere:  </p>\n<ul>\n<li><b>s</b>: the average flux level of each planet</li>\n<li><b>d(t)</b>: the sensor drift term, modeled as a cubic polynomial</li>\n<li><b>r</b>: the relative drop in flux during the transit phase</li>\n<li><b>y_true</b>: the ground-truth white light curve</li>\n<li><b>n_it</b>, <b>n_oot</b>: the number of samples in the in-transit (IT) and out-of-transit (OOT) phases, respectively</li>\n</ul>\n<p>The constraint enforces that the average of the drift term is zero, ensuring identifiability with respect to <em>s</em>.  We solve this optimization independently for each planet.  The predicted transit depth for each planet is then computed as <strong>1 − r</strong>.  <br>\n<br><br>\nFor planets affected by <strong>limb darkening</strong>, we did not use the above model and optimization.  Instead, we estimated the transit depth as:   <code>1 − y_true.min() / y_true.max()</code>.  We analyzed the light curves and transit depths of planets with limb darkening and concluded that this approximation was not a bad estimation (see the figure below).<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F13731448%2Fbe9bacf24a1ad50280ec4aee0bc5c9a1%2Flightcurve_limb_darkening.png?generation=1758952471574339&amp;alt=media\" alt=\"\"></p>\n<h2>Sigma Estimation</h2>\n<p>We estimated the average sigma for each planet from the relative standard deviations of the light curve in the time and wavelength directions.  We did not predict wavelength-dependent sigmas; instead, only the average sigma was predicted.  <br>\nFrom the light curve, we compute sigma_t (time-direction relative standard deviation) and sigma_w (wavelength-direction relative standard deviation), and then calculate the combined uncertainty for each planet as:<br>\n$$<br>\n\\sigma_{\\mathrm{combined}}<br>\n= \\sqrt{\\,w_t \\,\\sigma_t^2 + w_w \\,\\sigma_w^2\\,}<br>\n$$<br>\nwhere w_t and w_w are hyperparameters.  We then define k, representing the relative uncertainty of each planet, as:<br>\n$$<br>\nk = \\frac{\\sigma_{\\mathrm{combined}}}{\\mathrm{Med}}<br>\n$$<br>\nHere, Med is the median of sigma_combined across all planets.  The predicted sigma for each planet is then given by:<br>\n$$<br>\n\\sigma_{\\mathrm{pred}} = k \\cdot \\sigma_{\\mathrm{base}}<br>\n$$<br>\nwhere sigma_base is a hyperparameter representing the baseline sigma.  This ensures that planets with larger overall uncertainty are assigned larger sigma values, while planets with smaller uncertainty receive smaller values.  <br>\nThe estimation methods for sigma_t and sigma_w are described below.  </p>\n<h3>Estimation of sigma_t</h3>\n<p>For this part, we referred to the excellent public notebook:  <br>\n(<a href=\"https://www.kaggle.com/code/antonsibilev/very-fast-with-hot-pixels-enabled\" target=\"_blank\">https://www.kaggle.com/code/antonsibilev/very-fast-with-hot-pixels-enabled</a>)  We sincerely thank <a href=\"https://www.kaggle.com/antonsibilev\" target=\"_blank\">@antonsibilev</a> for sharing it.<br>\nThe time-direction relative standard deviation sigma_t is computed as:<br>\n$$<br>\n\\sigma_{t}<br>\n= \\frac{1}{\\bar y^{\\text{oot}}}\\,<br>\n\\sqrt{ \\frac{\\operatorname{Var}(y^{\\text{oot}})}{n_{\\text{oot}}}<br>\n    + \\frac{\\operatorname{Var}(y^{\\text{it}})}{n_{\\text{it}}} }<br>\n$$<br>\nwhere <code>y_bar_oot</code> is the mean of the out-of-transit (OOT) white light curve. The sigma_t is calculated for each planet. The sigma_t can be interpreted as a measure of the signal’s intrinsic noise.</p>\n<h3>Estimation of sigma_w</h3>\n<p>For each wavelength channel c = 1,…,283, we compute the in-transit and out-of-transit mean flux as:<br>\n$$<br>\n\\mu_{\\mathrm{it},c} = \\frac{1}{n_{\\mathrm{it}}}\\sum_{t=1}^{n_{\\mathrm{it}}} y_{t,c}<br>\n$$<br>\n$$<br>\n\\mu_{\\mathrm{oot},c} = \\frac{1}{n_{\\mathrm{oot}}}\\sum_{t=1}^{n_{\\mathrm{oot}}} y_{t,c}<br>\n$$<br>\nThe rough estimator of the transit depth at wavelength c is then:<br>\n$$<br>\n\\delta_c = 1 - \\frac{\\mu_{\\mathrm{it},c}}{\\mu_{\\mathrm{oot},c}}<br>\n$$<br>\nAfter smoothing delta_c with a Savitzky–Golay filter, the wavelength-direction relative standard deviation sigma_w is computed as:<br>\n$$<br>\n\\sigma_w = \\mathrm{STD}(\\delta_c)<br>\n$$<br>\nThis allows us to estimate the variability of transit depths across wavelengths.</p>\n<h2>Postprocessing</h2>\n<p>For planets with anomalous light curve shapes or where transit phase detection failed, we applied a fallback procedure.  In these cases, the transit depth was estimated as:   <code>1 − y_true.min() / y_true.max()</code>. Additionally, we multiplied the predicted sigma by about three to prevent performance degradation.</p>\n<h2>Ensembling</h2>\n<p>We prepared 100 different hyperparameter configurations and ensembled their predictions.  The hyperparameter configurations were explored using Optuna with the TPE sampler.  We split the data into train and validation sets, and searched hyperparameters on the train set, and then selected candidate configurations that achieved good scores on both train and validation.  <br>\nEnsembling the 100 predictions slightly improved the local score (from 0.437 to 0.440), but did not provide any gain on the Public or Private leaderboard.  </p>\n<h2>What Did Not Work</h2>\n<p>Predicting wavelength-dependent transit depths did not work well.  Using only the average transit depth consistently yielded better performance.  </p>",
  "messages": [
    {
      "id": 3294884,
      "postDate": "2025-09-27T03:23:21.580Z",
      "content": "<h2>Introduction</h2>\n<p>We ( <a href=\"https://www.kaggle.com/ihiratch\" target=\"_blank\">@ihiratch</a>, <a href=\"https://www.kaggle.com/prgckwb\" target=\"_blank\">@prgckwb</a>, <a href=\"https://www.kaggle.com/itachicom615\" target=\"_blank\">@itachicom615</a>, <a href=\"https://www.kaggle.com/nashisandesu\" target=\"_blank\">@nashisandesu</a>) would like to express our gratitude to the competition organizers.  It was a really fun and insightful challenge, and we look forward to participating again. <br>\n<br><br>\nOur approach consists of the following steps:</p>\n<ul>\n<li>Preprocessing</li>\n<li>Transit phase detection</li>\n<li>Transit depth estimation</li>\n<li>Sigma estimation</li>\n<li>Postprocessing</li>\n<li>Ensembling</li>\n</ul>\n<p>We mainly used mathematical modeling instead of machine learning approach.  Our predictions focused on the average transit depth and sigma values.  We did not use wavelength-dependent predictions for either transit depth or sigma.  </p>\n<h2>Preprocessing</h2>\n<p>For preprocessing, we relied on this excellent public notebook<br>\n( <a href=\"https://www.kaggle.com/code/vitalykudelya/neurips-non-ml-transit-curve-fitting\" target=\"_blank\">https://www.kaggle.com/code/vitalykudelya/neurips-non-ml-transit-curve-fitting</a> ). We are very grateful to <a href=\"https://www.kaggle.com/vitalykudelya\" target=\"_blank\">@vitalykudelya</a> for sharing it.<br>\nThe main modification we made was accelerating the linearity correction step with Numba.  This reduced the preprocessing time from about 6 hours to roughly 2 hours.  </p>\n<h2>Transit Phase Detection</h2>\n<p>We detected the transit phase using the white light curve (i.e., the light curve averaged over all wavelengths).  </p>\n<h3>Method Overview</h3>\n<p>We approximate the ingress and egress regions with straight lines.  The boundaries (ingress start, ingress end, egress start, egress end) can be estimated at the points where the white light curve begins to deviate from these lines (see the figure below).<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F13731448%2Ff68b64aaf455ef45880a535f63ebc7a7%2Ftransit_detection.png?generation=1758952453670141&amp;alt=media\" alt=\"\"></p>\n<h3>Details</h3>\n<ul>\n<li>We first obtain the indices corresponding to the maximum and minimum values of differences of the white light curve.  </li>\n<li>The minimum difference roughly corresponds to the middle of the ingress transition.  </li>\n<li>The maximum difference roughly corresponds to the middle of the egress transition.  </li>\n<li>Around these indices, we construct local linear fits (“local lines”).  </li>\n<li>We then calculate the residuals between the local lines and the white light curve.  </li>\n<li>The points where the residuals started to deviate from zero are taken as the transit phase boundaries.  We detect a deviation when the residual exceeds <code>std(white light curve) × THRESH_RATIO</code> (a hyperparameter). </li>\n</ul>\n<h2>Transit Depth Estimation</h2>\n<p>We predicted the average transit depth for each planet using a mathematical model. The model was a simplified version of last year’s first-place mathematical model. ( <a href=\"https://www.kaggle.com/competitions/ariel-data-challenge-2024/writeups/c-number-daiwakun-1st-place-solution\" target=\"_blank\">https://www.kaggle.com/competitions/ariel-data-challenge-2024/writeups/c-number-daiwakun-1st-place-solution</a> ) Many thanks to <a href=\"https://www.kaggle.com/cnumber\" target=\"_blank\">@cnumber</a> and <a href=\"https://www.kaggle.com/daiwakun\" target=\"_blank\">@daiwakun</a> for sharing their excellent solution!<br>\nThe idea is to lift the in-transit (IT) flux so that it smoothly connects with the out-of-transit (OOT) flux through fitting.  The prediction is made for the <strong>average transit depth per planet</strong>.  We did not predict wavelength-dependent transit depths (we tried, but performance degraded).  <br>\n<br><br>\nModel: <br>\n$$<br>\ny(t) = s \\,(1 + d(t)), \\quad t \\in \\text{OOT}<br>\n$$<br>\n$$<br>\ny(t) = r \\cdot s \\,(1 + d(t)), \\quad t \\in \\text{IT}<br>\n$$<br>\nOptimization:<br>\n$$<br>\n\\min_{s,\\,r,\\,d} \\;\\;<br>\n\\sum_{t \\in \\mathrm{IT}} \\frac{1}{n_{\\mathrm{it}}}\\,\\bigl(y_{\\text{true}}(t)-y(t)\\bigr)^2<br>\n\\;+\\;<br>\n\\sum_{t \\in \\mathrm{OOT}} \\frac{1}{n_{\\mathrm{oot}}}\\,\\bigl(y_{\\text{true}}(t)-y(t)\\bigr)^2<br>\n\\quad<br>\n\\text{s.t.} \\quad <br>\n\\frac{1}{\\,n_{\\mathrm{it}}+n_{\\mathrm{oot}}\\,}\\sum_{t} d(t) = 0<br>\n$$<br>\nHere:  </p>\n<ul>\n<li><b>s</b>: the average flux level of each planet</li>\n<li><b>d(t)</b>: the sensor drift term, modeled as a cubic polynomial</li>\n<li><b>r</b>: the relative drop in flux during the transit phase</li>\n<li><b>y_true</b>: the ground-truth white light curve</li>\n<li><b>n_it</b>, <b>n_oot</b>: the number of samples in the in-transit (IT) and out-of-transit (OOT) phases, respectively</li>\n</ul>\n<p>The constraint enforces that the average of the drift term is zero, ensuring identifiability with respect to <em>s</em>.  We solve this optimization independently for each planet.  The predicted transit depth for each planet is then computed as <strong>1 − r</strong>.  <br>\n<br><br>\nFor planets affected by <strong>limb darkening</strong>, we did not use the above model and optimization.  Instead, we estimated the transit depth as:   <code>1 − y_true.min() / y_true.max()</code>.  We analyzed the light curves and transit depths of planets with limb darkening and concluded that this approximation was not a bad estimation (see the figure below).<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F13731448%2Fbe9bacf24a1ad50280ec4aee0bc5c9a1%2Flightcurve_limb_darkening.png?generation=1758952471574339&amp;alt=media\" alt=\"\"></p>\n<h2>Sigma Estimation</h2>\n<p>We estimated the average sigma for each planet from the relative standard deviations of the light curve in the time and wavelength directions.  We did not predict wavelength-dependent sigmas; instead, only the average sigma was predicted.  <br>\nFrom the light curve, we compute sigma_t (time-direction relative standard deviation) and sigma_w (wavelength-direction relative standard deviation), and then calculate the combined uncertainty for each planet as:<br>\n$$<br>\n\\sigma_{\\mathrm{combined}}<br>\n= \\sqrt{\\,w_t \\,\\sigma_t^2 + w_w \\,\\sigma_w^2\\,}<br>\n$$<br>\nwhere w_t and w_w are hyperparameters.  We then define k, representing the relative uncertainty of each planet, as:<br>\n$$<br>\nk = \\frac{\\sigma_{\\mathrm{combined}}}{\\mathrm{Med}}<br>\n$$<br>\nHere, Med is the median of sigma_combined across all planets.  The predicted sigma for each planet is then given by:<br>\n$$<br>\n\\sigma_{\\mathrm{pred}} = k \\cdot \\sigma_{\\mathrm{base}}<br>\n$$<br>\nwhere sigma_base is a hyperparameter representing the baseline sigma.  This ensures that planets with larger overall uncertainty are assigned larger sigma values, while planets with smaller uncertainty receive smaller values.  <br>\nThe estimation methods for sigma_t and sigma_w are described below.  </p>\n<h3>Estimation of sigma_t</h3>\n<p>For this part, we referred to the excellent public notebook:  <br>\n(<a href=\"https://www.kaggle.com/code/antonsibilev/very-fast-with-hot-pixels-enabled\" target=\"_blank\">https://www.kaggle.com/code/antonsibilev/very-fast-with-hot-pixels-enabled</a>)  We sincerely thank <a href=\"https://www.kaggle.com/antonsibilev\" target=\"_blank\">@antonsibilev</a> for sharing it.<br>\nThe time-direction relative standard deviation sigma_t is computed as:<br>\n$$<br>\n\\sigma_{t}<br>\n= \\frac{1}{\\bar y^{\\text{oot}}}\\,<br>\n\\sqrt{ \\frac{\\operatorname{Var}(y^{\\text{oot}})}{n_{\\text{oot}}}<br>\n    + \\frac{\\operatorname{Var}(y^{\\text{it}})}{n_{\\text{it}}} }<br>\n$$<br>\nwhere <code>y_bar_oot</code> is the mean of the out-of-transit (OOT) white light curve. The sigma_t is calculated for each planet. The sigma_t can be interpreted as a measure of the signal’s intrinsic noise.</p>\n<h3>Estimation of sigma_w</h3>\n<p>For each wavelength channel c = 1,…,283, we compute the in-transit and out-of-transit mean flux as:<br>\n$$<br>\n\\mu_{\\mathrm{it},c} = \\frac{1}{n_{\\mathrm{it}}}\\sum_{t=1}^{n_{\\mathrm{it}}} y_{t,c}<br>\n$$<br>\n$$<br>\n\\mu_{\\mathrm{oot},c} = \\frac{1}{n_{\\mathrm{oot}}}\\sum_{t=1}^{n_{\\mathrm{oot}}} y_{t,c}<br>\n$$<br>\nThe rough estimator of the transit depth at wavelength c is then:<br>\n$$<br>\n\\delta_c = 1 - \\frac{\\mu_{\\mathrm{it},c}}{\\mu_{\\mathrm{oot},c}}<br>\n$$<br>\nAfter smoothing delta_c with a Savitzky–Golay filter, the wavelength-direction relative standard deviation sigma_w is computed as:<br>\n$$<br>\n\\sigma_w = \\mathrm{STD}(\\delta_c)<br>\n$$<br>\nThis allows us to estimate the variability of transit depths across wavelengths.</p>\n<h2>Postprocessing</h2>\n<p>For planets with anomalous light curve shapes or where transit phase detection failed, we applied a fallback procedure.  In these cases, the transit depth was estimated as:   <code>1 − y_true.min() / y_true.max()</code>. Additionally, we multiplied the predicted sigma by about three to prevent performance degradation.</p>\n<h2>Ensembling</h2>\n<p>We prepared 100 different hyperparameter configurations and ensembled their predictions.  The hyperparameter configurations were explored using Optuna with the TPE sampler.  We split the data into train and validation sets, and searched hyperparameters on the train set, and then selected candidate configurations that achieved good scores on both train and validation.  <br>\nEnsembling the 100 predictions slightly improved the local score (from 0.437 to 0.440), but did not provide any gain on the Public or Private leaderboard.  </p>\n<h2>What Did Not Work</h2>\n<p>Predicting wavelength-dependent transit depths did not work well.  Using only the average transit depth consistently yielded better performance.  </p>",
      "rawMarkdown": "\n## Introduction\n\nWe ( @ihiratch, @prgckwb, @itachicom615, @nashisandesu) would like to express our gratitude to the competition organizers.  It was a really fun and insightful challenge, and we look forward to participating again. \n<br>\nOur approach consists of the following steps:\n<ul>\n<li>Preprocessing</li>\n<li>Transit phase detection</li>\n<li>Transit depth estimation</li>\n<li>Sigma estimation</li>\n<li>Postprocessing</li>\n<li>Ensembling</li>\n</ul>\nWe mainly used mathematical modeling instead of machine learning approach.  Our predictions focused on the average transit depth and sigma values.  We did not use wavelength-dependent predictions for either transit depth or sigma.  \n\n## Preprocessing\n\nFor preprocessing, we relied on this excellent public notebook\n( https://www.kaggle.com/code/vitalykudelya/neurips-non-ml-transit-curve-fitting ). We are very grateful to @vitalykudelya for sharing it.\nThe main modification we made was accelerating the linearity correction step with Numba.  This reduced the preprocessing time from about 6 hours to roughly 2 hours.  \n\n## Transit Phase Detection\n\nWe detected the transit phase using the white light curve (i.e., the light curve averaged over all wavelengths).  \n\n### Method Overview\nWe approximate the ingress and egress regions with straight lines.  The boundaries (ingress start, ingress end, egress start, egress end) can be estimated at the points where the white light curve begins to deviate from these lines (see the figure below).\n\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F13731448%2Ff68b64aaf455ef45880a535f63ebc7a7%2Ftransit_detection.png?generation=1758952453670141&alt=media)\n\n### Details\n\n- We first obtain the indices corresponding to the maximum and minimum values of differences of the white light curve.  \n\t- The minimum difference roughly corresponds to the middle of the ingress transition.  \n\t- The maximum difference roughly corresponds to the middle of the egress transition.  \n\n- Around these indices, we construct local linear fits (“local lines”).  \n- We then calculate the residuals between the local lines and the white light curve.  \n- The points where the residuals started to deviate from zero are taken as the transit phase boundaries.  We detect a deviation when the residual exceeds `std(white light curve) × THRESH_RATIO` (a hyperparameter). \n\n## Transit Depth Estimation\n\nWe predicted the average transit depth for each planet using a mathematical model. The model was a simplified version of last year’s first-place mathematical model. ( https://www.kaggle.com/competitions/ariel-data-challenge-2024/writeups/c-number-daiwakun-1st-place-solution ) Many thanks to @cnumber and @daiwakun for sharing their excellent solution!\n\nThe idea is to lift the in-transit (IT) flux so that it smoothly connects with the out-of-transit (OOT) flux through fitting.  The prediction is made for the **average transit depth per planet**.  We did not predict wavelength-dependent transit depths (we tried, but performance degraded).  \n<br>\nModel: \n\n$$\ny(t) = s \\,(1 + d(t)), \\quad t \\in \\text{OOT}\n$$\n$$\ny(t) = r \\cdot s \\,(1 + d(t)), \\quad t \\in \\text{IT}\n$$\n\nOptimization:\n\n$$\n\\min_{s,\\,r,\\,d} \\;\\;\n\\sum_{t \\in \\mathrm{IT}} \\frac{1}{n_{\\mathrm{it}}}\\,\\bigl(y_{\\text{true}}(t)-y(t)\\bigr)^2\n\\;+\\;\n\\sum_{t \\in \\mathrm{OOT}} \\frac{1}{n_{\\mathrm{oot}}}\\,\\bigl(y_{\\text{true}}(t)-y(t)\\bigr)^2\n\\quad\n\\text{s.t.} \\quad \n\\frac{1}{\\,n_{\\mathrm{it}}+n_{\\mathrm{oot}}\\,}\\sum_{t} d(t) = 0\n$$\n\nHere:  \n<ul>\n<li><b>s</b>: the average flux level of each planet</li>\n<li><b>d(t)</b>: the sensor drift term, modeled as a cubic polynomial</li>\n<li><b>r</b>: the relative drop in flux during the transit phase</li>\n<li><b>y_true</b>: the ground-truth white light curve</li>\n<li><b>n_it</b>, <b>n_oot</b>: the number of samples in the in-transit (IT) and out-of-transit (OOT) phases, respectively</li>\n</ul>\n\nThe constraint enforces that the average of the drift term is zero, ensuring identifiability with respect to *s*.  We solve this optimization independently for each planet.  The predicted transit depth for each planet is then computed as **1 − r**.  \n\n<br>\nFor planets affected by **limb darkening**, we did not use the above model and optimization.  Instead, we estimated the transit depth as:   `1 − y_true.min() / y_true.max()`.  We analyzed the light curves and transit depths of planets with limb darkening and concluded that this approximation was not a bad estimation (see the figure below).\n\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F13731448%2Fbe9bacf24a1ad50280ec4aee0bc5c9a1%2Flightcurve_limb_darkening.png?generation=1758952471574339&alt=media)\n\n\n## Sigma Estimation\n\nWe estimated the average sigma for each planet from the relative standard deviations of the light curve in the time and wavelength directions.  We did not predict wavelength-dependent sigmas; instead, only the average sigma was predicted.  \n\nFrom the light curve, we compute sigma_t (time-direction relative standard deviation) and sigma_w (wavelength-direction relative standard deviation), and then calculate the combined uncertainty for each planet as:\n\n$$\n\\sigma_{\\mathrm{combined}}\n= \\sqrt{\\,w_t \\,\\sigma_t^2 + w_w \\,\\sigma_w^2\\,}\n$$\n\nwhere w_t and w_w are hyperparameters.  We then define k, representing the relative uncertainty of each planet, as:\n\n$$\nk = \\frac{\\sigma_{\\mathrm{combined}}}{\\mathrm{Med}}\n$$\nHere, Med is the median of sigma_combined across all planets.  The predicted sigma for each planet is then given by:\n$$\n\\sigma_{\\mathrm{pred}} = k \\cdot \\sigma_{\\mathrm{base}}\n$$\nwhere sigma_base is a hyperparameter representing the baseline sigma.  This ensures that planets with larger overall uncertainty are assigned larger sigma values, while planets with smaller uncertainty receive smaller values.  \n\nThe estimation methods for sigma_t and sigma_w are described below.  \n### Estimation of sigma_t\n\nFor this part, we referred to the excellent public notebook:  \n(https://www.kaggle.com/code/antonsibilev/very-fast-with-hot-pixels-enabled)  We sincerely thank @antonsibilev for sharing it.\n\nThe time-direction relative standard deviation sigma_t is computed as:\n\n$$\n\\sigma_{t}\n= \\frac{1}{\\bar y^{\\text{oot}}}\\,\n\\sqrt{ \\frac{\\operatorname{Var}(y^{\\text{oot}})}{n_{\\text{oot}}}\n     + \\frac{\\operatorname{Var}(y^{\\text{it}})}{n_{\\text{it}}} }\n$$\n\nwhere `y_bar_oot` is the mean of the out-of-transit (OOT) white light curve. The sigma_t is calculated for each planet. The sigma_t can be interpreted as a measure of the signal’s intrinsic noise.\n### Estimation of sigma_w\n\nFor each wavelength channel c = 1,…,283, we compute the in-transit and out-of-transit mean flux as:\n\n$$\n\\mu_{\\mathrm{it},c} = \\frac{1}{n_{\\mathrm{it}}}\\sum_{t=1}^{n_{\\mathrm{it}}} y_{t,c}\n$$\n$$\n\\mu_{\\mathrm{oot},c} = \\frac{1}{n_{\\mathrm{oot}}}\\sum_{t=1}^{n_{\\mathrm{oot}}} y_{t,c}\n$$\n\n\nThe rough estimator of the transit depth at wavelength c is then:\n\n$$\n\\delta_c = 1 - \\frac{\\mu_{\\mathrm{it},c}}{\\mu_{\\mathrm{oot},c}}\n$$\n\nAfter smoothing delta_c with a Savitzky–Golay filter, the wavelength-direction relative standard deviation sigma_w is computed as:\n\n$$\n\\sigma_w = \\mathrm{STD}(\\delta_c)\n$$\n\nThis allows us to estimate the variability of transit depths across wavelengths.\n\n\n## Postprocessing\n\nFor planets with anomalous light curve shapes or where transit phase detection failed, we applied a fallback procedure.  In these cases, the transit depth was estimated as:   `1 − y_true.min() / y_true.max()`. Additionally, we multiplied the predicted sigma by about three to prevent performance degradation.\n\n\n## Ensembling\n\nWe prepared 100 different hyperparameter configurations and ensembled their predictions.  The hyperparameter configurations were explored using Optuna with the TPE sampler.  We split the data into train and validation sets, and searched hyperparameters on the train set, and then selected candidate configurations that achieved good scores on both train and validation.  \n\nEnsembling the 100 predictions slightly improved the local score (from 0.437 to 0.440), but did not provide any gain on the Public or Private leaderboard.  \n\n## What Did Not Work\n\nPredicting wavelength-dependent transit depths did not work well.  Using only the average transit depth consistently yielded better performance.  \n\n\n\n\n",
      "votes": 6
    },
    {
      "id": 3294896,
      "postDate": "2025-09-27T04:25:06.050Z",
      "content": "<p>Construction of local linear fit - it is a neat idea. Congratulations!</p>",
      "rawMarkdown": "Construction of local linear fit - it is a neat idea. Congratulations!",
      "replies": [
        {
          "id": 3294930,
          "postDate": "2025-09-27T06:25:49.033Z",
          "content": "<p><a href=\"https://www.kaggle.com/viji1609\" target=\"_blank\">@viji1609</a> <br>\nThank you! And congratulations on your 16th place as well 🎉</p>",
          "rawMarkdown": "@viji1609 \nThank you! And congratulations on your 16th place as well 🎉"
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 3294896,
      "author_name": "Viji",
      "author_url": "",
      "post_date": "2025-09-27T04:25:06.050000",
      "content": "<p>Construction of local linear fit - it is a neat idea. Congratulations!</p>",
      "votes": 0,
      "replies": [
        {
          "id": 3294930,
          "author_name": "ihiratch",
          "author_url": "",
          "post_date": "2025-09-27T06:25:49.033000",
          "content": "<p><a href=\"https://www.kaggle.com/viji1609\" target=\"_blank\">@viji1609</a> <br>\nThank you! And congratulations on your 16th place as well 🎉</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "3294884": "\n## Introduction\n\nWe ( @ihiratch, @prgckwb, @itachicom615, @nashisandesu) would like to express our gratitude to the competition organizers.  It was a really fun and insightful challenge, and we look forward to participating again. \n<br>\nOur approach consists of the following steps:\n<ul>\n<li>Preprocessing</li>\n<li>Transit phase detection</li>\n<li>Transit depth estimation</li>\n<li>Sigma estimation</li>\n<li>Postprocessing</li>\n<li>Ensembling</li>\n</ul>\nWe mainly used mathematical modeling instead of machine learning approach.  Our predictions focused on the average transit depth and sigma values.  We did not use wavelength-dependent predictions for either transit depth or sigma.  \n\n## Preprocessing\n\nFor preprocessing, we relied on this excellent public notebook\n( https://www.kaggle.com/code/vitalykudelya/neurips-non-ml-transit-curve-fitting ). We are very grateful to @vitalykudelya for sharing it.\nThe main modification we made was accelerating the linearity correction step with Numba.  This reduced the preprocessing time from about 6 hours to roughly 2 hours.  \n\n## Transit Phase Detection\n\nWe detected the transit phase using the white light curve (i.e., the light curve averaged over all wavelengths).  \n\n### Method Overview\nWe approximate the ingress and egress regions with straight lines.  The boundaries (ingress start, ingress end, egress start, egress end) can be estimated at the points where the white light curve begins to deviate from these lines (see the figure below).\n\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F13731448%2Ff68b64aaf455ef45880a535f63ebc7a7%2Ftransit_detection.png?generation=1758952453670141&alt=media)\n\n### Details\n\n- We first obtain the indices corresponding to the maximum and minimum values of differences of the white light curve.  \n\t- The minimum difference roughly corresponds to the middle of the ingress transition.  \n\t- The maximum difference roughly corresponds to the middle of the egress transition.  \n\n- Around these indices, we construct local linear fits (“local lines”).  \n- We then calculate the residuals between the local lines and the white light curve.  \n- The points where the residuals started to deviate from zero are taken as the transit phase boundaries.  We detect a deviation when the residual exceeds `std(white light curve) × THRESH_RATIO` (a hyperparameter). \n\n## Transit Depth Estimation\n\nWe predicted the average transit depth for each planet using a mathematical model. The model was a simplified version of last year’s first-place mathematical model. ( https://www.kaggle.com/competitions/ariel-data-challenge-2024/writeups/c-number-daiwakun-1st-place-solution ) Many thanks to @cnumber and @daiwakun for sharing their excellent solution!\n\nThe idea is to lift the in-transit (IT) flux so that it smoothly connects with the out-of-transit (OOT) flux through fitting.  The prediction is made for the **average transit depth per planet**.  We did not predict wavelength-dependent transit depths (we tried, but performance degraded).  \n<br>\nModel: \n\n$$\ny(t) = s \\,(1 + d(t)), \\quad t \\in \\text{OOT}\n$$\n$$\ny(t) = r \\cdot s \\,(1 + d(t)), \\quad t \\in \\text{IT}\n$$\n\nOptimization:\n\n$$\n\\min_{s,\\,r,\\,d} \\;\\;\n\\sum_{t \\in \\mathrm{IT}} \\frac{1}{n_{\\mathrm{it}}}\\,\\bigl(y_{\\text{true}}(t)-y(t)\\bigr)^2\n\\;+\\;\n\\sum_{t \\in \\mathrm{OOT}} \\frac{1}{n_{\\mathrm{oot}}}\\,\\bigl(y_{\\text{true}}(t)-y(t)\\bigr)^2\n\\quad\n\\text{s.t.} \\quad \n\\frac{1}{\\,n_{\\mathrm{it}}+n_{\\mathrm{oot}}\\,}\\sum_{t} d(t) = 0\n$$\n\nHere:  \n<ul>\n<li><b>s</b>: the average flux level of each planet</li>\n<li><b>d(t)</b>: the sensor drift term, modeled as a cubic polynomial</li>\n<li><b>r</b>: the relative drop in flux during the transit phase</li>\n<li><b>y_true</b>: the ground-truth white light curve</li>\n<li><b>n_it</b>, <b>n_oot</b>: the number of samples in the in-transit (IT) and out-of-transit (OOT) phases, respectively</li>\n</ul>\n\nThe constraint enforces that the average of the drift term is zero, ensuring identifiability with respect to *s*.  We solve this optimization independently for each planet.  The predicted transit depth for each planet is then computed as **1 − r**.  \n\n<br>\nFor planets affected by **limb darkening**, we did not use the above model and optimization.  Instead, we estimated the transit depth as:   `1 − y_true.min() / y_true.max()`.  We analyzed the light curves and transit depths of planets with limb darkening and concluded that this approximation was not a bad estimation (see the figure below).\n\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F13731448%2Fbe9bacf24a1ad50280ec4aee0bc5c9a1%2Flightcurve_limb_darkening.png?generation=1758952471574339&alt=media)\n\n\n## Sigma Estimation\n\nWe estimated the average sigma for each planet from the relative standard deviations of the light curve in the time and wavelength directions.  We did not predict wavelength-dependent sigmas; instead, only the average sigma was predicted.  \n\nFrom the light curve, we compute sigma_t (time-direction relative standard deviation) and sigma_w (wavelength-direction relative standard deviation), and then calculate the combined uncertainty for each planet as:\n\n$$\n\\sigma_{\\mathrm{combined}}\n= \\sqrt{\\,w_t \\,\\sigma_t^2 + w_w \\,\\sigma_w^2\\,}\n$$\n\nwhere w_t and w_w are hyperparameters.  We then define k, representing the relative uncertainty of each planet, as:\n\n$$\nk = \\frac{\\sigma_{\\mathrm{combined}}}{\\mathrm{Med}}\n$$\nHere, Med is the median of sigma_combined across all planets.  The predicted sigma for each planet is then given by:\n$$\n\\sigma_{\\mathrm{pred}} = k \\cdot \\sigma_{\\mathrm{base}}\n$$\nwhere sigma_base is a hyperparameter representing the baseline sigma.  This ensures that planets with larger overall uncertainty are assigned larger sigma values, while planets with smaller uncertainty receive smaller values.  \n\nThe estimation methods for sigma_t and sigma_w are described below.  \n### Estimation of sigma_t\n\nFor this part, we referred to the excellent public notebook:  \n(https://www.kaggle.com/code/antonsibilev/very-fast-with-hot-pixels-enabled)  We sincerely thank @antonsibilev for sharing it.\n\nThe time-direction relative standard deviation sigma_t is computed as:\n\n$$\n\\sigma_{t}\n= \\frac{1}{\\bar y^{\\text{oot}}}\\,\n\\sqrt{ \\frac{\\operatorname{Var}(y^{\\text{oot}})}{n_{\\text{oot}}}\n     + \\frac{\\operatorname{Var}(y^{\\text{it}})}{n_{\\text{it}}} }\n$$\n\nwhere `y_bar_oot` is the mean of the out-of-transit (OOT) white light curve. The sigma_t is calculated for each planet. The sigma_t can be interpreted as a measure of the signal’s intrinsic noise.\n### Estimation of sigma_w\n\nFor each wavelength channel c = 1,…,283, we compute the in-transit and out-of-transit mean flux as:\n\n$$\n\\mu_{\\mathrm{it},c} = \\frac{1}{n_{\\mathrm{it}}}\\sum_{t=1}^{n_{\\mathrm{it}}} y_{t,c}\n$$\n$$\n\\mu_{\\mathrm{oot},c} = \\frac{1}{n_{\\mathrm{oot}}}\\sum_{t=1}^{n_{\\mathrm{oot}}} y_{t,c}\n$$\n\n\nThe rough estimator of the transit depth at wavelength c is then:\n\n$$\n\\delta_c = 1 - \\frac{\\mu_{\\mathrm{it},c}}{\\mu_{\\mathrm{oot},c}}\n$$\n\nAfter smoothing delta_c with a Savitzky–Golay filter, the wavelength-direction relative standard deviation sigma_w is computed as:\n\n$$\n\\sigma_w = \\mathrm{STD}(\\delta_c)\n$$\n\nThis allows us to estimate the variability of transit depths across wavelengths.\n\n\n## Postprocessing\n\nFor planets with anomalous light curve shapes or where transit phase detection failed, we applied a fallback procedure.  In these cases, the transit depth was estimated as:   `1 − y_true.min() / y_true.max()`. Additionally, we multiplied the predicted sigma by about three to prevent performance degradation.\n\n\n## Ensembling\n\nWe prepared 100 different hyperparameter configurations and ensembled their predictions.  The hyperparameter configurations were explored using Optuna with the TPE sampler.  We split the data into train and validation sets, and searched hyperparameters on the train set, and then selected candidate configurations that achieved good scores on both train and validation.  \n\nEnsembling the 100 predictions slightly improved the local score (from 0.437 to 0.440), but did not provide any gain on the Public or Private leaderboard.  \n\n## What Did Not Work\n\nPredicting wavelength-dependent transit depths did not work well.  Using only the average transit depth consistently yielded better performance.  \n\n\n\n\n",
    "3294896": "Construction of local linear fit - it is a neat idea. Congratulations!"
  }
}