{
  "id": 666180,
  "title": "Stacked LightGBM Ensemble for Detecting Market Reversal Points",
  "content": "<h2><strong>1. Problem Overview</strong></h2>\n<p>The objective of this competition is to detect <strong>reversal points in U.S. equities</strong> using historical and engineered market features.<br>\nThe task is formulated as a <strong>multi-class classification problem</strong>, where each observation represents a market state that may indicate a potential trend reversal.</p>\n<p>Given the noisy nature of financial time-series data and the presence of class imbalance, the proposed solution focuses on <strong>robust target engineering, strong tree-based models, and ensemble learning</strong>.</p>\n<hr>\n<h2><strong>2. Target Engineering</strong></h2>\n<p>The original target labels contain several closely related categories. To reduce label noise and improve class separability, the labels were consolidated into <strong>three semantically meaningful classes</strong>:</p>\n<ul>\n<li><strong>H (High-type reversal)</strong> → <code>{HH, LH, H}</code></li>\n<li><strong>L (Low-type reversal)</strong> → <code>{HL, LL, L}</code></li>\n<li><strong>None</strong> → all remaining cases</li>\n</ul>\n<p>This simplification leads to:</p>\n<ul>\n<li>Improved model stability  </li>\n<li>Higher <strong>Macro F1</strong> performance  </li>\n<li>Better generalization on unseen data  </li>\n</ul>\n<hr>\n<h2><strong>3. Data Preparation</strong></h2>\n<ul>\n<li>Training data from both the <strong>original and newly released datasets</strong> were merged to increase data coverage.</li>\n<li>Non-informative identifiers and time-related columns were removed.</li>\n<li>Missing values were handled using <strong>zero imputation</strong>.</li>\n<li>Feature alignment between training and test sets was strictly enforced to ensure consistency.</li>\n</ul>\n<hr>\n<h2><strong>4. Handling Class Imbalance</strong></h2>\n<p>The dataset exhibits significant class imbalance.<br>\nTo mitigate this issue, <strong>balanced class weights</strong> were computed and converted into <strong>sample weights</strong>, which were passed directly to the learning algorithms during training.</p>\n<p>This approach ensures that minority classes contribute proportionally to the loss function and leads to improved <strong>Macro F1</strong> performance.</p>\n<hr>\n<h2><strong>5. Cross-Validation Strategy</strong></h2>\n<p>A <strong>5-fold Stratified K-Fold Cross-Validation</strong> strategy was employed to:</p>\n<ul>\n<li>Preserve class distribution across folds  </li>\n<li>Provide reliable <strong>out-of-fold (OOF)</strong> performance estimates  </li>\n<li>Reduce overfitting and variance  </li>\n</ul>\n<hr>\n<h2><strong>6. Base Models (Level-0 Learners)</strong></h2>\n<p>To maximize ensemble diversity, <strong>three different LightGBM models</strong> were trained:</p>\n<h3><strong>Model 1: LightGBM (GBDT – Default)</strong></h3>\n<ul>\n<li>Strong baseline model  </li>\n<li>Balanced bias–variance tradeoff  </li>\n</ul>\n<h3><strong>Model 2: LightGBM (GBDT – Tuned)</strong></h3>\n<ul>\n<li>Larger tree capacity  </li>\n<li>L1/L2 regularization  </li>\n<li>Optimized feature and bagging fractions  </li>\n</ul>\n<h3><strong>Model 3: LightGBM (DART)</strong></h3>\n<ul>\n<li>Dropout-based boosting strategy  </li>\n<li>Reduces correlation between trees  </li>\n<li>Improves ensemble robustness  </li>\n</ul>\n<p>All base models:</p>\n<ul>\n<li>Used the <strong><code>multiclassova</code></strong> objective  </li>\n<li>Applied <strong>early stopping</strong>  </li>\n<li>Were evaluated using <strong>Macro F1 Score</strong></li>\n</ul>\n<hr>\n<h2><strong>7. Evaluation Metric</strong></h2>\n<p><strong>Macro F1 Score</strong> was selected as the primary evaluation metric because:</p>\n<ul>\n<li>It treats all classes equally  </li>\n<li>It is robust to class imbalance  </li>\n<li>It better reflects real-world classification performance than accuracy  </li>\n</ul>\n<hr>\n<h2><strong>8. Ensemble Method: Stacking</strong></h2>\n<p>Instead of simple averaging, a <strong>stacking ensemble</strong> approach was implemented.</p>\n<h3><strong>Level-0 Output</strong></h3>\n<ul>\n<li>Out-of-fold probability predictions from all three LightGBM base models  </li>\n</ul>\n<h3><strong>Level-1 Meta Learner</strong></h3>\n<ul>\n<li><strong>Multinomial Logistic Regression</strong>  </li>\n<li>Chosen for its simplicity, stability, and effectiveness in combining probabilistic outputs  </li>\n<li>Regularization helps prevent overfitting  </li>\n</ul>\n<hr>\n<h2><strong>9. Meta-Model Validation</strong></h2>\n<p>The meta-learner was evaluated using <strong>cross-validated OOF predictions</strong> and achieved a <strong>higher Macro F1 score than any individual base model</strong>.</p>\n<p>This confirms that the stacking framework successfully captures the <strong>complementary strengths</strong> of the base learners and improves overall performance.</p>\n<hr>",
  "comments": [
    {
      "id": 3386724,
      "author_name": "tomy4reel",
      "author_url": "",
      "post_date": "2026-01-05T18:42:44.487000",
      "content": "<p>Thanks for sharing Mohamed👍. </p>\n<p>What were your private and public leaderboard scores on the new test set</p>",
      "votes": 0,
      "replies": [
        {
          "id": 3386746,
          "author_name": "Mohamed Zakaria",
          "author_url": "",
          "post_date": "2026-01-05T19:04:23.587000",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/tomy4reel\" target=\"_blank\">@tomy4reel</a>,</p>\n<p>For the new test set, my solution achieved:\nPublic Leaderboard (97%)\nPrivate Leaderboard (96%)</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "comment_count": 2,
  "messages": [
    {
      "id": 3386705,
      "postDate": "2026-01-05T17:59:41.307Z",
      "content": "<h2><strong>1. Problem Overview</strong></h2>\n<p>The objective of this competition is to detect <strong>reversal points in U.S. equities</strong> using historical and engineered market features.<br>\nThe task is formulated as a <strong>multi-class classification problem</strong>, where each observation represents a market state that may indicate a potential trend reversal.</p>\n<p>Given the noisy nature of financial time-series data and the presence of class imbalance, the proposed solution focuses on <strong>robust target engineering, strong tree-based models, and ensemble learning</strong>.</p>\n<hr>\n<h2><strong>2. Target Engineering</strong></h2>\n<p>The original target labels contain several closely related categories. To reduce label noise and improve class separability, the labels were consolidated into <strong>three semantically meaningful classes</strong>:</p>\n<ul>\n<li><strong>H (High-type reversal)</strong> → <code>{HH, LH, H}</code></li>\n<li><strong>L (Low-type reversal)</strong> → <code>{HL, LL, L}</code></li>\n<li><strong>None</strong> → all remaining cases</li>\n</ul>\n<p>This simplification leads to:</p>\n<ul>\n<li>Improved model stability  </li>\n<li>Higher <strong>Macro F1</strong> performance  </li>\n<li>Better generalization on unseen data  </li>\n</ul>\n<hr>\n<h2><strong>3. Data Preparation</strong></h2>\n<ul>\n<li>Training data from both the <strong>original and newly released datasets</strong> were merged to increase data coverage.</li>\n<li>Non-informative identifiers and time-related columns were removed.</li>\n<li>Missing values were handled using <strong>zero imputation</strong>.</li>\n<li>Feature alignment between training and test sets was strictly enforced to ensure consistency.</li>\n</ul>\n<hr>\n<h2><strong>4. Handling Class Imbalance</strong></h2>\n<p>The dataset exhibits significant class imbalance.<br>\nTo mitigate this issue, <strong>balanced class weights</strong> were computed and converted into <strong>sample weights</strong>, which were passed directly to the learning algorithms during training.</p>\n<p>This approach ensures that minority classes contribute proportionally to the loss function and leads to improved <strong>Macro F1</strong> performance.</p>\n<hr>\n<h2><strong>5. Cross-Validation Strategy</strong></h2>\n<p>A <strong>5-fold Stratified K-Fold Cross-Validation</strong> strategy was employed to:</p>\n<ul>\n<li>Preserve class distribution across folds  </li>\n<li>Provide reliable <strong>out-of-fold (OOF)</strong> performance estimates  </li>\n<li>Reduce overfitting and variance  </li>\n</ul>\n<hr>\n<h2><strong>6. Base Models (Level-0 Learners)</strong></h2>\n<p>To maximize ensemble diversity, <strong>three different LightGBM models</strong> were trained:</p>\n<h3><strong>Model 1: LightGBM (GBDT – Default)</strong></h3>\n<ul>\n<li>Strong baseline model  </li>\n<li>Balanced bias–variance tradeoff  </li>\n</ul>\n<h3><strong>Model 2: LightGBM (GBDT – Tuned)</strong></h3>\n<ul>\n<li>Larger tree capacity  </li>\n<li>L1/L2 regularization  </li>\n<li>Optimized feature and bagging fractions  </li>\n</ul>\n<h3><strong>Model 3: LightGBM (DART)</strong></h3>\n<ul>\n<li>Dropout-based boosting strategy  </li>\n<li>Reduces correlation between trees  </li>\n<li>Improves ensemble robustness  </li>\n</ul>\n<p>All base models:</p>\n<ul>\n<li>Used the <strong><code>multiclassova</code></strong> objective  </li>\n<li>Applied <strong>early stopping</strong>  </li>\n<li>Were evaluated using <strong>Macro F1 Score</strong></li>\n</ul>\n<hr>\n<h2><strong>7. Evaluation Metric</strong></h2>\n<p><strong>Macro F1 Score</strong> was selected as the primary evaluation metric because:</p>\n<ul>\n<li>It treats all classes equally  </li>\n<li>It is robust to class imbalance  </li>\n<li>It better reflects real-world classification performance than accuracy  </li>\n</ul>\n<hr>\n<h2><strong>8. Ensemble Method: Stacking</strong></h2>\n<p>Instead of simple averaging, a <strong>stacking ensemble</strong> approach was implemented.</p>\n<h3><strong>Level-0 Output</strong></h3>\n<ul>\n<li>Out-of-fold probability predictions from all three LightGBM base models  </li>\n</ul>\n<h3><strong>Level-1 Meta Learner</strong></h3>\n<ul>\n<li><strong>Multinomial Logistic Regression</strong>  </li>\n<li>Chosen for its simplicity, stability, and effectiveness in combining probabilistic outputs  </li>\n<li>Regularization helps prevent overfitting  </li>\n</ul>\n<hr>\n<h2><strong>9. Meta-Model Validation</strong></h2>\n<p>The meta-learner was evaluated using <strong>cross-validated OOF predictions</strong> and achieved a <strong>higher Macro F1 score than any individual base model</strong>.</p>\n<p>This confirms that the stacking framework successfully captures the <strong>complementary strengths</strong> of the base learners and improves overall performance.</p>\n<hr>",
      "rawMarkdown": "## **1. Problem Overview**\nThe objective of this competition is to detect **reversal points in U.S. equities** using historical and engineered market features.  \nThe task is formulated as a **multi-class classification problem**, where each observation represents a market state that may indicate a potential trend reversal.\n\nGiven the noisy nature of financial time-series data and the presence of class imbalance, the proposed solution focuses on **robust target engineering, strong tree-based models, and ensemble learning**.\n\n---\n\n## **2. Target Engineering**\nThe original target labels contain several closely related categories. To reduce label noise and improve class separability, the labels were consolidated into **three semantically meaningful classes**:\n\n- **H (High-type reversal)** → `{HH, LH, H}`\n- **L (Low-type reversal)** → `{HL, LL, L}`\n- **None** → all remaining cases\n\nThis simplification leads to:\n-  Improved model stability  \n-  Higher **Macro F1** performance  \n-  Better generalization on unseen data  \n\n---\n\n## **3. Data Preparation**\n- Training data from both the **original and newly released datasets** were merged to increase data coverage.\n- Non-informative identifiers and time-related columns were removed.\n- Missing values were handled using **zero imputation**.\n- Feature alignment between training and test sets was strictly enforced to ensure consistency.\n\n---\n\n## **4. Handling Class Imbalance**\nThe dataset exhibits significant class imbalance.  \nTo mitigate this issue, **balanced class weights** were computed and converted into **sample weights**, which were passed directly to the learning algorithms during training.\n\nThis approach ensures that minority classes contribute proportionally to the loss function and leads to improved **Macro F1** performance.\n\n---\n\n## **5. Cross-Validation Strategy**\nA **5-fold Stratified K-Fold Cross-Validation** strategy was employed to:\n- Preserve class distribution across folds  \n- Provide reliable **out-of-fold (OOF)** performance estimates  \n- Reduce overfitting and variance  \n\n---\n\n## **6. Base Models (Level-0 Learners)**\nTo maximize ensemble diversity, **three different LightGBM models** were trained:\n\n### **Model 1: LightGBM (GBDT – Default)**\n- Strong baseline model  \n- Balanced bias–variance tradeoff  \n\n### **Model 2: LightGBM (GBDT – Tuned)**\n- Larger tree capacity  \n- L1/L2 regularization  \n- Optimized feature and bagging fractions  \n\n### **Model 3: LightGBM (DART)**\n- Dropout-based boosting strategy  \n- Reduces correlation between trees  \n- Improves ensemble robustness  \n\nAll base models:\n- Used the **`multiclassova`** objective  \n- Applied **early stopping**  \n- Were evaluated using **Macro F1 Score**\n\n---\n\n## **7. Evaluation Metric**\n**Macro F1 Score** was selected as the primary evaluation metric because:\n- It treats all classes equally  \n- It is robust to class imbalance  \n- It better reflects real-world classification performance than accuracy  \n\n---\n\n## **8. Ensemble Method: Stacking**\nInstead of simple averaging, a **stacking ensemble** approach was implemented.\n\n### **Level-0 Output**\n- Out-of-fold probability predictions from all three LightGBM base models  \n\n### **Level-1 Meta Learner**\n- **Multinomial Logistic Regression**  \n- Chosen for its simplicity, stability, and effectiveness in combining probabilistic outputs  \n- Regularization helps prevent overfitting  \n\n---\n\n## **9. Meta-Model Validation**\nThe meta-learner was evaluated using **cross-validated OOF predictions** and achieved a **higher Macro F1 score than any individual base model**.\n\nThis confirms that the stacking framework successfully captures the **complementary strengths** of the base learners and improves overall performance.\n\n---\n",
      "votes": 9
    },
    {
      "id": 3386724,
      "postDate": "2026-01-05T18:42:44.487Z",
      "content": "<p>Thanks for sharing Mohamed👍. </p>\n<p>What were your private and public leaderboard scores on the new test set</p>",
      "rawMarkdown": "Thanks for sharing Mohamed👍. \n\nWhat were your private and public leaderboard scores on the new test set",
      "replies": [
        {
          "id": 3386746,
          "postDate": "2026-01-05T19:04:23.587Z",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/tomy4reel\" target=\"_blank\">@tomy4reel</a>,</p>\n<p>For the new test set, my solution achieved:\nPublic Leaderboard (97%)\nPrivate Leaderboard (96%)</p>",
          "rawMarkdown": "Hi @tomy4reel,\n\nFor the new test set, my solution achieved:\nPublic Leaderboard (97%)\nPrivate Leaderboard (96%)"
        }
      ]
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-19T07:13:04Z",
  "competition_id": 114135,
  "competition_slug": "detecting-reversal-points-in-us-equities",
  "team_id": 15036546,
  "solution_url": ""
}