{
  "id": 566538,
  "title": "What I learned from this competition(rank933)",
  "content": "<p>Firstly, I would like to express my gratitude to the organizers for organizing this competition and congratulate everyone on achieving outstanding results.</p>\n<p>I didn't expect the scores of LB and PB in this competition to be very close. Everyone's scores are concentrated in the open source code area (LB: 0.693, PB: 0.692).If you surpass open source code, your ranking will be higher; if you lose to open source code, your ranking will be lower, just like me.</p>\n<p>Although I have been ranked down, I still want to share what I have gained from this competition.</p>\n<h2>TabM</h2>\n<p>This is the model I learned in the <a href=\"https://www.kaggle.com/competitions/um-game-playing-strength-of-mcts-variants\">MCTS</a> competition. I tried it in the final stage of this competition and used the MSE loss function, obtaining a CV of 0.660, LB of 0.670, I didn't have time to learn the code in the open source area, so I didn't use this model in the end.</p>\n<h2>TargetEncoder</h2>\n<p>This is what I learned from <a href=\"https://www.kaggle.com/competitions/playground-series-s4e12/discussion/554328\">this</a>.</p>\n<p>We can construct various TargetEncoders for categorical variables. For example,<code>Groupby(CATEGORY_COL)[TARGET_COL].agg(['mean'])</code>,We can use the mean of TARGET_COL to represent CATEGORY_COL.To ensure the reliability of cross validation results, we will groupby the training data and map it to the validation and testing data.</p>\n<p>Here are some commonly used Target Encoders.</p>\n<pre><code>()\n ():\n    mean=np.mean(a)\n     (np.where(a&gt;=mean)[])/(np.where(a&lt;=mean)[])\n ():\n    mean=np.mean(a)\n     (np.where(a&gt;=mean)[])-(np.where(a&lt;=mean)[])    \n ():\n     ():\n         x.quantile(percentage)\n     q\n ():\n     ():\n        hist, _ = np.histogram(x, bins=, =(np.(x), np.(x)))\n         hist[index]\n     make_histogram\nSTATS=[,,,,,,,\n                 (,stable_divide),(,stable_diff),\n                 (,qp()),(,qp()),(,qp()),(,qp())\n                ]+[(,get_hist(i))  i  () ]\n</code></pre>\n<h2>Construct new category features</h2>\n<p>For example, we have two categorical variables, <code>sex=['male','female'],is_child=['Yes','No']</code>.We can combine them to obtain <code>['male_Yes','male_No','female_Yes','female_No']</code>.</p>\n<pre><code>df[col1++col2]=df[col1].astype()+df[col2].astype()\n</code></pre>\n<p>Since this is synthetic data, I haven't done any other feature engineering.</p>\n<h2>Weighted training</h2>\n<p>reference:<a href=\"https://www.kaggle.com/code/ambrosm/esp-eda-which-makes-sense/notebook\">ESP EDA which makes sense ⭐️⭐️⭐️⭐️⭐️</a> Insight: As the competition objective (equitability across diverse patient populations) rewards models with similar concordance scores for all six race groups, a possible strategy could be that we artificially make the predictions for Asian patients worse.</p>\n<p>I attempted to assign different weights to race_group and efs here.</p>\n<p>best wishes for everyone.Happy Kaggling.</p>",
  "comments": [],
  "comment_count": 0,
  "messages": [
    {
      "id": 3141871,
      "postDate": "2025-03-06T00:51:11.873Z",
      "content": "<p>Firstly, I would like to express my gratitude to the organizers for organizing this competition and congratulate everyone on achieving outstanding results.</p>\n<p>I didn't expect the scores of LB and PB in this competition to be very close. Everyone's scores are concentrated in the open source code area (LB: 0.693, PB: 0.692).If you surpass open source code, your ranking will be higher; if you lose to open source code, your ranking will be lower, just like me.</p>\n<p>Although I have been ranked down, I still want to share what I have gained from this competition.</p>\n<h2>TabM</h2>\n<p>This is the model I learned in the <a href=\"https://www.kaggle.com/competitions/um-game-playing-strength-of-mcts-variants\">MCTS</a> competition. I tried it in the final stage of this competition and used the MSE loss function, obtaining a CV of 0.660, LB of 0.670, I didn't have time to learn the code in the open source area, so I didn't use this model in the end.</p>\n<h2>TargetEncoder</h2>\n<p>This is what I learned from <a href=\"https://www.kaggle.com/competitions/playground-series-s4e12/discussion/554328\">this</a>.</p>\n<p>We can construct various TargetEncoders for categorical variables. For example,<code>Groupby(CATEGORY_COL)[TARGET_COL].agg(['mean'])</code>,We can use the mean of TARGET_COL to represent CATEGORY_COL.To ensure the reliability of cross validation results, we will groupby the training data and map it to the validation and testing data.</p>\n<p>Here are some commonly used Target Encoders.</p>\n<pre><code>()\n ():\n    mean=np.mean(a)\n     (np.where(a&gt;=mean)[])/(np.where(a&lt;=mean)[])\n ():\n    mean=np.mean(a)\n     (np.where(a&gt;=mean)[])-(np.where(a&lt;=mean)[])    \n ():\n     ():\n         x.quantile(percentage)\n     q\n ():\n     ():\n        hist, _ = np.histogram(x, bins=, =(np.(x), np.(x)))\n         hist[index]\n     make_histogram\nSTATS=[,,,,,,,\n                 (,stable_divide),(,stable_diff),\n                 (,qp()),(,qp()),(,qp()),(,qp())\n                ]+[(,get_hist(i))  i  () ]\n</code></pre>\n<h2>Construct new category features</h2>\n<p>For example, we have two categorical variables, <code>sex=['male','female'],is_child=['Yes','No']</code>.We can combine them to obtain <code>['male_Yes','male_No','female_Yes','female_No']</code>.</p>\n<pre><code>df[col1++col2]=df[col1].astype()+df[col2].astype()\n</code></pre>\n<p>Since this is synthetic data, I haven't done any other feature engineering.</p>\n<h2>Weighted training</h2>\n<p>reference:<a href=\"https://www.kaggle.com/code/ambrosm/esp-eda-which-makes-sense/notebook\">ESP EDA which makes sense ⭐️⭐️⭐️⭐️⭐️</a> Insight: As the competition objective (equitability across diverse patient populations) rewards models with similar concordance scores for all six race groups, a possible strategy could be that we artificially make the predictions for Asian patients worse.</p>\n<p>I attempted to assign different weights to race_group and efs here.</p>\n<p>best wishes for everyone.Happy Kaggling.</p>",
      "rawMarkdown": "Firstly, I would like to express my gratitude to the organizers for organizing this competition and congratulate everyone on achieving outstanding results.\n\nI didn't expect the scores of LB and PB in this competition to be very close. Everyone's scores are concentrated in the open source code area (LB: 0.693, PB: 0.692).If you surpass open source code, your ranking will be higher; if you lose to open source code, your ranking will be lower, just like me.\n\nAlthough I have been ranked down, I still want to share what I have gained from this competition.\n\n## TabM  \n\nThis is the model I learned in the <a href=\"https://www.kaggle.com/competitions/um-game-playing-strength-of-mcts-variants\">MCTS</a> competition. I tried it in the final stage of this competition and used the MSE loss function, obtaining a CV of 0.660, LB of 0.670, I didn't have time to learn the code in the open source area, so I didn't use this model in the end.\n\n## TargetEncoder\n\nThis is what I learned from <a href=\"https://www.kaggle.com/competitions/playground-series-s4e12/discussion/554328\">this</a>.\n\nWe can construct various TargetEncoders for categorical variables. For example,`Groupby(CATEGORY_COL)[TARGET_COL].agg(['mean'])`,We can use the mean of TARGET_COL to represent CATEGORY_COL.To ensure the reliability of cross validation results, we will groupby the training data and map it to the validation and testing data.\n\nHere are some commonly used Target Encoders.\n```python\nprint(\"STATS\")\ndef stable_divide(a):\n    mean=np.mean(a)\n    return len(np.where(a>=mean)[0])/len(np.where(a<=mean)[0])\ndef stable_diff(a):\n    mean=np.mean(a)\n    return len(np.where(a>=mean)[0])-len(np.where(a<=mean)[0])    \ndef qp(percentage):\n    def q(x):\n        return x.quantile(percentage)\n    return q\ndef get_hist(index):\n    def make_histogram(x):\n        hist, _ = np.histogram(x, bins=10, range=(np.min(x), np.max(x)))\n        return hist[index]\n    return make_histogram\nSTATS=['mean','std','max','median','skew','count','nunique',\n                 ('stable_divide',stable_divide),('stable_diff',stable_diff),\n                 ('q0',qp(0.05)),('q1',qp(0.25)),('q3',qp(0.75)),('q4',qp(0.95))\n                ]+[(f'hist{i}',get_hist(i)) for i in range(10) ]\n```\n\n## Construct new category features\n\nFor example, we have two categorical variables, `sex=['male','female'],is_child=['Yes','No']`.We can combine them to obtain `['male_Yes','male_No','female_Yes','female_No']`.\n```python\ndf[col1+\"_\"+col2]=df[col1].astype(str)+df[col2].astype(str)\n```\n\nSince this is synthetic data, I haven't done any other feature engineering.\n\n## Weighted training\n\nreference:<a href=\"https://www.kaggle.com/code/ambrosm/esp-eda-which-makes-sense/notebook\">ESP EDA which makes sense ⭐️⭐️⭐️⭐️⭐️</a> Insight: As the competition objective (equitability across diverse patient populations) rewards models with similar concordance scores for all six race groups, a possible strategy could be that we artificially make the predictions for Asian patients worse.\n\nI attempted to assign different weights to race_group and efs here.\n\nbest wishes for everyone.Happy Kaggling.",
      "votes": 15
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-19T19:45:13Z",
  "competition_id": 70942,
  "competition_slug": "equity-post-HCT-survival-predictions",
  "team_id": 13055545,
  "solution_url": "/competitions/equity-post-HCT-survival-predictions/writeups/just-shakedown-what-i-learned-from-this-competitio"
}