{
  "id": 665370,
  "title": "1st place tricks,blind blend and luck",
  "content": "<p>My final solution used tabm, realmlp, and lightgbm+catboost.I haven't done much feature engineering.</p>\n<h2>Feature Engineer</h2>\n<pre><code>import pandas as pd\n\ndrop_cols=['ID',#row_id,meaningless\n           'model',#在TargetEncoder在lgb最后10个重要的特征.\n           'device_type'#在TargetEncoder在lgb仅次于'model'\n\n          ]\ntrain=pd.read_csv(\"/kaggle/input/computer-prices-2025/computer_prices_all.csv\").drop(drop_cols,axis=1)\ntest=pd.read_csv(\"/kaggle/input/computer-prices-2025/computer_prices_test.csv\").drop(drop_cols,axis=1)\nprint(f\"train.shape:{train.shape},test.shape:{test.shape}\")\n\nfor c in ['weight_kg','display_size_in']:\n    for df in [train,test]:\n        df[c]=df[c].round()\n\nfor c in ['resolution']:\n    for df in [train,test]:\n        df[c+\"_0\"]=df[c].apply(lambda x:int(x.split(\"x\")[0]))\n        df[c+\"_1\"]=df[c].apply(lambda x:int(x.split(\"x\")[1]))\n\ntrain.head()\n</code></pre>\n<h2>Drop bad case and weighted training</h2>\n<p>I first trained a model by removing some particularly large samples based on the absolute value loss of oof and true, and weighted the samples with moderate loss.</p>\n<p>Because easy samples can be learned without serious study, and difficult samples cannot be learned with serious study.</p>\n<pre><code>#根据oof得到权重.\noof=np.load(\"/kaggle/working/Yunbase_info/lgb_seed2025_repeat0_fold5_price.npy\")\ntrue=train['price'].values\nprint(oof.shape,true.shape)\n\ndef metric(t,p):\n    return np.abs(t-p)\ntrain['pred']=oof\ntrain['abs']=metric(train['price'].values,train['pred'].values)\n\n#去除异常值\nprint(train.shape)\ntrain=train[train['abs']&lt;2000].reset_index(drop=True)\nprint(train.shape)\n\nloss_per_sample=train['abs'].values\ntrain.drop(['pred','abs'],axis=1,inplace=True)\n\n\nq30, q70 = np.percentile(loss_per_sample, [30, 70])\ntrain['weight'] = np.where((loss_per_sample &gt;= q30) &amp; (loss_per_sample &lt;= q70), 3, 1)\ntrain['weight'].value_counts()\n</code></pre>\n<p>After removing the difficult samples, the CV decreased to around 175, so in the end, we could only blind blend.</p>\n<h2>Pseudo label</h2>\n<p>After obtaining the predicted results of the test data, add the test data to train the final model.</p>",
  "comments": [],
  "comment_count": 0,
  "messages": [
    {
      "id": 3384319,
      "postDate": "2026-01-01T01:33:15.787Z",
      "content": "<p>My final solution used tabm, realmlp, and lightgbm+catboost.I haven't done much feature engineering.</p>\n<h2>Feature Engineer</h2>\n<pre><code>import pandas as pd\n\ndrop_cols=['ID',#row_id,meaningless\n           'model',#在TargetEncoder在lgb最后10个重要的特征.\n           'device_type'#在TargetEncoder在lgb仅次于'model'\n\n          ]\ntrain=pd.read_csv(\"/kaggle/input/computer-prices-2025/computer_prices_all.csv\").drop(drop_cols,axis=1)\ntest=pd.read_csv(\"/kaggle/input/computer-prices-2025/computer_prices_test.csv\").drop(drop_cols,axis=1)\nprint(f\"train.shape:{train.shape},test.shape:{test.shape}\")\n\nfor c in ['weight_kg','display_size_in']:\n    for df in [train,test]:\n        df[c]=df[c].round()\n\nfor c in ['resolution']:\n    for df in [train,test]:\n        df[c+\"_0\"]=df[c].apply(lambda x:int(x.split(\"x\")[0]))\n        df[c+\"_1\"]=df[c].apply(lambda x:int(x.split(\"x\")[1]))\n\ntrain.head()\n</code></pre>\n<h2>Drop bad case and weighted training</h2>\n<p>I first trained a model by removing some particularly large samples based on the absolute value loss of oof and true, and weighted the samples with moderate loss.</p>\n<p>Because easy samples can be learned without serious study, and difficult samples cannot be learned with serious study.</p>\n<pre><code>#根据oof得到权重.\noof=np.load(\"/kaggle/working/Yunbase_info/lgb_seed2025_repeat0_fold5_price.npy\")\ntrue=train['price'].values\nprint(oof.shape,true.shape)\n\ndef metric(t,p):\n    return np.abs(t-p)\ntrain['pred']=oof\ntrain['abs']=metric(train['price'].values,train['pred'].values)\n\n#去除异常值\nprint(train.shape)\ntrain=train[train['abs']&lt;2000].reset_index(drop=True)\nprint(train.shape)\n\nloss_per_sample=train['abs'].values\ntrain.drop(['pred','abs'],axis=1,inplace=True)\n\n\nq30, q70 = np.percentile(loss_per_sample, [30, 70])\ntrain['weight'] = np.where((loss_per_sample &gt;= q30) &amp; (loss_per_sample &lt;= q70), 3, 1)\ntrain['weight'].value_counts()\n</code></pre>\n<p>After removing the difficult samples, the CV decreased to around 175, so in the end, we could only blind blend.</p>\n<h2>Pseudo label</h2>\n<p>After obtaining the predicted results of the test data, add the test data to train the final model.</p>",
      "rawMarkdown": "My final solution used tabm, realmlp, and lightgbm+catboost.I haven't done much feature engineering.\n\n## Feature Engineer\n\n```python\nimport pandas as pd\n\ndrop_cols=['ID',#row_id,meaningless\n           'model',#在TargetEncoder在lgb最后10个重要的特征.\n           'device_type'#在TargetEncoder在lgb仅次于'model'\n          \n          ]\ntrain=pd.read_csv(\"/kaggle/input/computer-prices-2025/computer_prices_all.csv\").drop(drop_cols,axis=1)\ntest=pd.read_csv(\"/kaggle/input/computer-prices-2025/computer_prices_test.csv\").drop(drop_cols,axis=1)\nprint(f\"train.shape:{train.shape},test.shape:{test.shape}\")\n\nfor c in ['weight_kg','display_size_in']:\n    for df in [train,test]:\n        df[c]=df[c].round()\n\nfor c in ['resolution']:\n    for df in [train,test]:\n        df[c+\"_0\"]=df[c].apply(lambda x:int(x.split(\"x\")[0]))\n        df[c+\"_1\"]=df[c].apply(lambda x:int(x.split(\"x\")[1]))\n\ntrain.head()\n```\n\n## Drop bad case and weighted training\n\nI first trained a model by removing some particularly large samples based on the absolute value loss of oof and true, and weighted the samples with moderate loss.\n\nBecause easy samples can be learned without serious study, and difficult samples cannot be learned with serious study.\n\n```python\n#根据oof得到权重.\noof=np.load(\"/kaggle/working/Yunbase_info/lgb_seed2025_repeat0_fold5_price.npy\")\ntrue=train['price'].values\nprint(oof.shape,true.shape)\n\ndef metric(t,p):\n    return np.abs(t-p)\ntrain['pred']=oof\ntrain['abs']=metric(train['price'].values,train['pred'].values)\n\n#去除异常值\nprint(train.shape)\ntrain=train[train['abs']<2000].reset_index(drop=True)\nprint(train.shape)\n\nloss_per_sample=train['abs'].values\ntrain.drop(['pred','abs'],axis=1,inplace=True)\n\n\nq30, q70 = np.percentile(loss_per_sample, [30, 70])\ntrain['weight'] = np.where((loss_per_sample >= q30) & (loss_per_sample <= q70), 3, 1)\ntrain['weight'].value_counts()\n```\n\nAfter removing the difficult samples, the CV decreased to around 175, so in the end, we could only blind blend.\n\n## Pseudo label\n\nAfter obtaining the predicted results of the test data, add the test data to train the final model.\n\n\n",
      "votes": 4
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-19T16:43:54Z",
  "competition_id": 116364,
  "competition_slug": "computer-prices-2025",
  "team_id": 14450607,
  "solution_url": "/competitions/computer-prices-2025/writeups/1st-place-tricksblind-blend-and-luck"
}