├── lama_new.zip ├── README.md ├── LICENSE ├── TPS_lightautoml_full_kfold.ipynb └── TPS_lightautoml_blend.ipynb /lama_new.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sb-ai-lab/LightAutoML_testers_solution_tps_sep_24/main/lama_new.zip -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LightAutoML_testers_solution_tps_sep_24 2 | [AutoML Grand Prix] "LightAutoML testers" team solution for TPS September 2024 3 | 4 | This solution uses slightly modified version of LightAutoML which would be included in future releases. 5 | 6 | This repository contains the code to reproduce the training part of the solution. 7 | 8 | ### Useful Links 9 | - [Full solution description](https://www.kaggle.com/competitions/playground-series-s4e9/discussion/531884) 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /TPS_lightautoml_full_kfold.ipynb: -------------------------------------------------------------------------------- 1 | {"cells":[{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-07-18T17:24:13.038257Z","iopub.status.busy":"2024-07-18T17:24:13.037557Z","iopub.status.idle":"2024-07-18T17:24:49.042400Z","shell.execute_reply":"2024-07-18T17:24:49.041283Z","shell.execute_reply.started":"2024-07-18T17:24:13.038204Z"},"trusted":true},"outputs":[],"source":["# Essential DS libraries\n","import numpy as np\n","import pandas as pd\n","import gc\n","from sklearn.metrics import roc_auc_score, mean_squared_error\n","from sklearn.model_selection import train_test_split\n","\n","# LightAutoML presets, task and report generation\n","from lightautoml.automl.presets.tabular_presets import TabularAutoML\n","from lightautoml.tasks import Task\n","\n","pd.set_option('display.max_columns', 50)"]},{"cell_type":"code","execution_count":2,"metadata":{"execution":{"iopub.execute_input":"2024-07-18T16:46:17.568031Z","iopub.status.busy":"2024-07-18T16:46:17.567603Z","iopub.status.idle":"2024-07-18T16:46:54.971281Z","shell.execute_reply":"2024-07-18T16:46:54.970299Z","shell.execute_reply.started":"2024-07-18T16:46:17.567998Z"},"trusted":true},"outputs":[{"data":{"text/html":["
\n","\n","\n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n","
idbrandmodelmodel_yearmilagefuel_typeenginetransmissionext_colint_colaccidentclean_titleprice
00MINICooper S Base2007213000Gasoline172.0HP 1.6L 4 Cylinder Engine Gasoline FuelA/TYellowGrayNone reportedYes4200
11LincolnLS V82002143250Gasoline252.0HP 3.9L 8 Cylinder Engine Gasoline FuelA/TSilverBeigeAt least 1 accident or damage reportedYes4999
22ChevroletSilverado 2500 LT2002136731E85 Flex Fuel320.0HP 5.3L 8 Cylinder Engine Flex Fuel Capab...A/TBlueGrayNone reportedYes13900
33GenesisG90 5.0 Ultimate201719500Gasoline420.0HP 5.0L 8 Cylinder Engine Gasoline FuelTransmission w/Dual Shift ModeBlackBlackNone reportedYes45000
44Mercedes-BenzMetris Base20217388Gasoline208.0HP 2.0L 4 Cylinder Engine Gasoline Fuel7-Speed A/TBlackBeigeNone reportedYes97500
\n","
"],"text/plain":[" id brand model model_year milage fuel_type \\\n","0 0 MINI Cooper S Base 2007 213000 Gasoline \n","1 1 Lincoln LS V8 2002 143250 Gasoline \n","2 2 Chevrolet Silverado 2500 LT 2002 136731 E85 Flex Fuel \n","3 3 Genesis G90 5.0 Ultimate 2017 19500 Gasoline \n","4 4 Mercedes-Benz Metris Base 2021 7388 Gasoline \n","\n"," engine \\\n","0 172.0HP 1.6L 4 Cylinder Engine Gasoline Fuel \n","1 252.0HP 3.9L 8 Cylinder Engine Gasoline Fuel \n","2 320.0HP 5.3L 8 Cylinder Engine Flex Fuel Capab... \n","3 420.0HP 5.0L 8 Cylinder Engine Gasoline Fuel \n","4 208.0HP 2.0L 4 Cylinder Engine Gasoline Fuel \n","\n"," transmission ext_col int_col \\\n","0 A/T Yellow Gray \n","1 A/T Silver Beige \n","2 A/T Blue Gray \n","3 Transmission w/Dual Shift Mode Black Black \n","4 7-Speed A/T Black Beige \n","\n"," accident clean_title price \n","0 None reported Yes 4200 \n","1 At least 1 accident or damage reported Yes 4999 \n","2 None reported Yes 13900 \n","3 None reported Yes 45000 \n","4 None reported Yes 97500 "]},"execution_count":2,"metadata":{},"output_type":"execute_result"}],"source":["train = pd.read_csv('data/train.csv')\n","test = pd.read_csv('data/test.csv')\n","\n","train_add = pd.read_csv('data/train_add.csv')\n","test_add = pd.read_csv('data/test_add.csv')\n","\n","train.head()"]},{"cell_type":"code","execution_count":3,"metadata":{},"outputs":[],"source":["all_data = pd.concat([train, train_add, test, test_add]).reset_index(drop = True)\n","all_data.head()\n","\n","def convert_engine(val):\n"," d = {\n"," 'engine_HP': np.nan,\n"," 'engine_L': np.nan,\n"," 'engine_cylinder': np.nan,\n"," 'engine_cylinder_type': np.nan,\n"," 'engine_fuel_type': np.nan,\n"," 'engine_type': np.nan,\n"," 'engine_v': np.nan,\n"," 'engine_vtype': np.nan\n"," }\n"," spl = val.replace('-', '').split(' ')\n"," pos_v1 = -1\n"," pos_v2 = -1\n"," for i, v in enumerate(spl):\n"," if v.endswith('HP'):\n"," d['engine_HP'] = float(v[:-2])\n"," elif v.endswith('L'):\n"," d['engine_L'] = float(v[:-1])\n"," elif v == 'Engine' and spl[i-1] == 'Cylinder':\n"," d['engine_cylinder'] = abs(float(spl[i-2].replace('V', '')))\n"," elif v == 'Fuel':\n"," d['engine_fuel_type'] = spl[i - 1]\n"," ##############\n"," elif v == 'Liter':\n"," d['engine_L'] = float(spl[i-1])\n"," elif v.startswith('V') or v.startswith('H') or v.startswith('I'):\n"," try:\n"," d['engine_cylinder'] = float(v[1:])\n"," d['engine_cylinder_type'] = v[0]\n"," pos_v1 = i\n"," except:\n"," pass\n"," elif v == 'DOHC' or v == 'OHV':\n"," d['engine_type'] = ' '.join(spl[i:])\n"," if pos_v2 != -1:\n"," d['engine_vtype'] = ' '.join(spl[pos_v2+1:i])\n"," elif pos_v1 != -1:\n"," d['engine_vtype'] = ' '.join(spl[pos_v1+1:i])\n"," elif v.endswith('V'):\n"," try:\n"," d['engine_v'] = float(v[:-1])\n"," pos_v2 = i\n"," except:\n"," pass\n"," return d\n","\n","all_data = pd.concat([all_data, pd.DataFrame.from_records(all_data['engine'].map(convert_engine).values)], axis = 1)\n","def milage_signs(val):\n"," v = str(val)\n"," for i in range(len(v) - 1, -1, -1):\n"," if v[i] != '0':\n"," break\n"," return (len(v) - 1 - i) / len(v) * 100\n","\n","\n","all_data['milage_signif_signs_perc'] = all_data['milage'].map(milage_signs)\n","for col in ['transmission', 'ext_col', 'int_col']:\n"," all_data[col] = all_data[col].str.lower()\n","\n","def convert_transmission(val):\n"," d = {\n"," 'transmission_speeds_cnt': np.nan,\n"," 'transmission_type': np.nan\n"," }\n"," spl = val.replace('/', '').split(' ')\n"," for i, v in enumerate(spl):\n"," if 'speed' in v:\n"," tmp = v.split('-')\n"," if len(tmp) > 1:\n"," if tmp[0] != 'single':\n"," d['transmission_speeds_cnt'] = float(tmp[0])\n"," else:\n"," d['transmission_speeds_cnt'] = 1.0\n"," else:\n"," d['transmission_speeds_cnt'] = float(spl[i-1])\n"," elif 'manual' in v or 'mt' in v:\n"," d['transmission_type'] = 'manual'\n"," elif 'automatic' in v or 'at' in v:\n"," d['transmission_type'] = 'automatic'\n"," return d\n","\n","all_data = pd.concat([all_data, pd.DataFrame.from_records(all_data['transmission'].map(convert_transmission).values)], axis = 1)\n","train2, train2_add, test2, test2_add = all_data.iloc[:len(train)], all_data.iloc[len(train):len(train)+len(train_add)], all_data.iloc[len(train)+len(train_add):len(train)+len(train_add)+len(test)], all_data.iloc[len(train)+len(train_add)+len(test):]\n"]},{"cell_type":"code","execution_count":4,"metadata":{},"outputs":[],"source":["from sklearn.preprocessing import StandardScaler, MinMaxScaler, RobustScaler\n","from lightautoml.text.nn_model import TorchUniversalModel\n","from lightautoml.text.embed import PLREmbedding, WeightedCatEmbedding, pooling_by_name\n","from lightautoml.ml_algo.torch_based.fttransformer.fttransformer_utils import Transformer\n","from collections import OrderedDict\n","from typing import List, Tuple, Type\n","from typing import Optional\n","from typing import Union\n","\n","import numpy as np\n","import torch\n","import torch.nn as nn\n","\n","from lightautoml.text.nn_model import TorchUniversalModel\n","from lightautoml.text.embed import PLREmbedding, WeightedCatEmbedding, pooling_by_name\n","from lightautoml.ml_algo.torch_based.fttransformer.fttransformer_utils import Transformer\n","from collections import OrderedDict\n","from typing import List, Tuple, Type\n","from typing import Optional\n","from typing import Union\n","\n","import numpy as np\n","import torch\n","import torch.nn as nn\n","\n","from transformers import BertConfig, BertModel, BertForSequenceClassification\n","from peft import get_peft_config, get_peft_model, LoraConfig, TaskType\n","\n","class BertEmbeddingsEmpty(nn.Module):\n"," \"\"\"Construct the embeddings from word, position and token_type embeddings.\"\"\"\n","\n"," def __init__(self):\n"," super().__init__()\n","\n"," # self.LayerNorm is not snake-cased to stick with TensorFlow model variable name and be able to load\n"," # any TensorFlow checkpoint file\n","\n","\n"," def forward(self, input_ids=None, token_type_ids=None, position_ids=None, inputs_embeds=None, **kwargs):\n"," if input_ids is not None:\n"," input_shape = input_ids.size()\n"," else:\n"," input_shape = inputs_embeds.size()[:-1]\n","\n"," seq_length = input_shape[1]\n","\n"," embeddings = inputs_embeds\n"," return embeddings\n","class FTTransformer2(nn.Module):\n"," \"\"\"FT Transformer (https://arxiv.org/abs/2106.11959v2) from https://github.com/lucidrains/tab-transformer-pytorch/tree/main.\n","\n"," Args:\n"," pooling: Pooling used for the last step.\n"," n_out: Output dimension, 1 for binary prediction.\n"," embedding_size: Embeddings size.\n"," depth: Number of Attention Blocks inside Transformer.\n"," heads: Number of heads in Attention.\n"," attn_dropout: Post-Attention dropout.\n"," ff_dropout: Feed-Forward Dropout.\n"," dim_head: Attention head dimension.\n"," num_enc_layers: Number of Transformer layers.\n"," device: Device to compute on.\n"," \"\"\"\n","\n"," def __init__(\n"," self,\n"," *,\n"," pooling: str = \"mean\",\n"," n_out: int = 1,\n"," embedding_size: int = 32,\n"," depth: int = 4,\n"," heads: int = 1,\n"," attn_dropout: float = 0.1,\n"," ff_dropout: float = 0.1,\n"," dim_head: int = 32,\n"," num_enc_layers: int = 2,\n"," device: Union[str, torch.device] = \"cuda:0\",\n"," **kwargs,\n"," ):\n"," super(FTTransformer2, self).__init__()\n"," self.device = device\n"," self.pooling = pooling_by_name[pooling]()\n"," print('pooling', pooling)\n"," \n"," # transformer\n"," # self.transformer = nn.Sequential(\n"," # *nn.ModuleList(\n"," # [\n"," # Transformer(\n"," # dim=embedding_size,\n"," # depth=depth,\n"," # heads=heads,\n"," # dim_head=dim_head,\n"," # attn_dropout=attn_dropout,\n"," # ff_dropout=ff_dropout,\n"," # )\n"," # for _ in range(num_enc_layers)\n"," # ]\n"," # )\n"," # )\n"," self.conf = {\"hidden_size\": 128, \"hidden_act\": \"gelu\", \"initializer_range\": 0.02, \"vocab_size\": 10, \"hidden_dropout_prob\": 0.1, \"num_attention_heads\": 2,\n"," \"type_vocab_size\": 2, \"max_position_embeddings\": 512, \"num_hidden_layers\": 2, \"intermediate_size\": 512, \"attention_probs_dropout_prob\": 0.1} #bert_tiny\n"," # self.conf = {\"hidden_size\": 512, \"hidden_act\": \"gelu\", \"initializer_range\": 0.02, \"vocab_size\": 10, \"hidden_dropout_prob\": 0.1, \"num_attention_heads\": 8,\n"," # \"type_vocab_size\": 2, \"max_position_embeddings\": 512, \"num_hidden_layers\": 4, \"intermediate_size\": 2048, \"attention_probs_dropout_prob\": 0.1} #bert_small\n","\n"," #self.transformer = BertModel(BertConfig(**self.conf))\n"," self.transformer = BertModel.from_pretrained(\"prajjwal1/bert-tiny\", output_attentions=True, output_hidden_states=True, cache_dir=\"./\")\n"," self.transformer.embeddings = BertEmbeddingsEmpty()\n","\n"," #peft_config = LoraConfig(task_type=TaskType.FEATURE_EXTRACTION, inference_mode=False, r=8, lora_alpha=32, lora_dropout=0.1)\n","\n"," #self.transformer = get_peft_model(self.transformer, peft_config)\n"," #print(self.transformer.print_trainable_parameters())\n","\n"," #self.fixup_initialization()\n"," # to logits\n"," \n"," self.to_logits = nn.Sequential(nn.BatchNorm1d(embedding_size), nn.Linear(embedding_size, n_out))\n","\n"," self.cls_token = nn.Embedding(2, embedding_size)\n","\n"," def fixup_initialization(self):\n"," temp_state_dic = {}\n"," en_layers = self.conf['num_hidden_layers']\n","\n"," for name, param in self.named_parameters():\n"," if 'weight' in name and param.data.dim() == 2:\n"," param = (9 * en_layers) ** (- 1 / 4) * param\n"," temp_state_dic[name] = param\n"," if np.any([1 if i in name else 0 for i in [\"linear1.weight\",\n"," \"linear2.weight\",\n"," \"self_attn.out_proj.weight\", #'self_attn.in_proj_weight', \n"," ]]):\n"," temp_state_dic[name] = (0.67 * (en_layers) ** (- 1. / 4.)) * param\n"," elif name in [\"self_attn.v_proj.weight\",]:\n"," temp_state_dic[name] = (0.67 * (en_layers) ** (- 1. / 4.)) * (param * (2**0.5))\n","\n"," for name in self.state_dict():\n"," if name not in temp_state_dic:\n"," temp_state_dic[name] = self.state_dict()[name]\n"," self.load_state_dict(temp_state_dic)\n","\n"," def forward(self, embedded):\n"," \"\"\"Transform the input tensor.\n","\n"," Args:\n"," embedded : torch.Tensor\n"," embedded fields\n","\n"," Returns:\n"," torch.Tensor\n","\n"," \"\"\"\n"," cls_token = torch.unsqueeze(\n"," self.cls_token(torch.ones(embedded.shape[0], dtype=torch.int).to(self.device)), dim=1\n"," )\n"," x = torch.cat((cls_token, embedded), dim=1)\n","\n"," x = self.transformer(inputs_embeds=x, \n"," #attention_mask=~mask\n"," ).last_hidden_state\n"," #x = self.transformer(x)\n"," x_mask = torch.ones(x.shape, dtype=torch.bool).to(self.device)\n"," pool_tokens = self.pooling(x=x, x_mask=x_mask)\n"," logits = self.to_logits(pool_tokens)\n"," return logits\n","\n","\n","class FTT_plus(TorchUniversalModel):\n"," \"\"\"Mixed data model.\n","\n"," Class for preparing input for DL model with mixed data.\n","\n"," Args:\n"," n_out: Number of output dimensions.\n"," cont_params: Dict with numeric model params.\n"," cat_params: Dict with category model para\n"," **kwargs: Loss, task and other parameters.\n","\n"," \"\"\"\n","\n"," def __init__(\n"," self,\n"," n_out: int = 1,\n"," cont_params = None,\n"," cat_params = None,\n"," **kwargs,\n"," ):\n"," # init parent class (need some helper functions to be used)\n"," super(FTT_plus, self).__init__(**{\n"," **kwargs,\n"," \"cont_params\": cont_params,\n"," \"cat_params\": cat_params,\n"," \"torch_model\": None, # dont need any model inside parent class\n"," })\n"," \n"," n_in = 0\n"," # add cont columns processing\n"," self.cont_embedder = PLREmbedding(**cont_params)\n"," n_in += self.cont_embedder.get_out_shape()\n"," \n"," # add cat columns processing\n"," self.cat_embedder = WeightedCatEmbedding(**cat_params)\n"," n_in += self.cat_embedder.get_out_shape()\n"," \n"," self.torch_model = FTTransformer2(\n"," **{\n"," **kwargs,\n"," **{\"n_in\": n_in, \"n_out\": n_out},\n"," }\n"," )\n"," \n"," def get_logits(self, inp) -> torch.Tensor:\n"," outputs = []\n"," outputs.append(self.cont_embedder(inp))\n"," outputs.append(self.cat_embedder(inp))\n"," \n"," if len(outputs) > 1:\n"," output = torch.cat(outputs, dim=1)\n"," else:\n"," output = outputs[0]\n"," \n"," logits = self.torch_model(output)\n"," return logits\n","\n","def myround(x, base=1000):\n"," return base * np.round(np.float32(x) / base)\n"," \n","cb_params = {\n"," \"task_type\": \"GPU\",\n"," #\"thread_count\": 4,\n"," \"random_seed\": 42,\n"," #\"learning_rate\": 0.03,\n"," #\"l2_leaf_reg\": 1e-2,\n"," \"bootstrap_type\": 'Bernoulli', #\"Bernoulli\",\n"," # \"bagging_temperature\": 1,\n"," 'subsample': 0.5,\n"," \"grow_policy\": \"SymmetricTree\",\n"," \"max_depth\": 9,\n"," #\"min_data_in_leaf\": 50000,\n"," \"one_hot_max_size\": 2, #10,\n"," \"fold_permutation_block\": 5,\n"," \"boosting_type\": \"Ordered\",\n"," \"boost_from_average\": False,#True,\n"," \"od_type\": \"Iter\",\n"," \"od_wait\": 200,\n"," \"max_bin\": 32, #32,\n"," \"feature_border_type\": \"GreedyLogSum\",\n"," \"nan_mode\": \"Min\",\n"," # \"silent\": False,\n"," \"verbose\": 100,\n"," \"allow_writing_files\": False,\n"," #'objective': 'Tweedie:variance_power=1.5',\n"," \n"," 'num_trees':50000,\n"," #'learning_rate': 0.02,\n"," #'random_strength':0,\n"," 'l2_leaf_reg': 5.5,\n"," #'max_depth': 9\n"," \n"," }\n","\n","lgb_params = {\n"," \"objective\": \"rmse\", \n"," 'metric': 'rmse', 'num_trees': 50000, \n"," 'max_depth': 7,\n"," 'min_data_in_leaf': 1000,\n"," 'bagging_fraction': 0.5,\n"," 'reg_alpha': 0, \n"," 'reg_lambda': 2,\n"," }"]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["from sklearn.model_selection import KFold\n","from sklearn.metrics import log_loss\n","import joblib\n","import os \n","res = {}\n","\n","for clip_name, clip in zip(['woclip', 'clip'], [999_999_999, 500_000]):\n"," for data_name, add_data in zip(['data', 'wodata'], [train2_add, None]):\n"," print(clip_name, data_name)\n"," # denselight classification\n"," def ll(x, y):\n"," return log_loss(x, y, labels=np.arange(y.shape[1]))\n"," task = Task('multiclass', metric=ll)\n"," oof = np.zeros(len(train2))\n"," pred = 0\n"," pred_add = 0\n"," models = {}\n"," if not os.path.isfile(f'denselight_cls_{clip_name}_{data_name}.jbl'):\n"," for fold, (tr_idx, te_idx) in enumerate(KFold(n_splits=10, random_state=42, shuffle=True).split(train2['price'], train2['price'], None)):\n"," x_tr, x_vl = train2.iloc[tr_idx].reset_index(drop=True), train2.iloc[te_idx].reset_index(drop=True)\n"," if add_data is not None:\n"," x_tr = pd.concat([x_tr, train2_add], axis=0).reset_index(drop=True)\n"," \n"," x_tr['price'] = np.clip(x_tr['price'], 0, clip)\n","\n"," x_tr['price'] = x_tr['price'].apply(myround )\n"," x_vl['price'] = x_vl['price'].apply(myround )\n","\n"," sorted_labels = np.array(sorted(np.unique(x_tr['price'])))\n"," sorted_labels2 = np.array(sorted(np.unique(x_vl['price'])))\n","\n"," mapping = {}\n"," for curr in sorted_labels2:\n"," diff = np.abs(sorted_labels - curr)\n"," idx = np.argmin(diff)\n"," mapping[curr] = sorted_labels[idx]\n"," x_vl['price'] = x_vl['price'].map(mapping)\n"," automl1 = TabularAutoML(\n"," task = task, \n"," timeout = 600 * 3600,\n"," cpu_limit = 2, \n"," gpu_ids = '0',\n"," selection_params = {'mode': 0},\n"," general_params = {\"use_algos\": [['denselight']]}, \n"," nn_params = {\n"," \"n_epochs\": 20, \n"," \"bs\": 1024//2, \n"," \"num_workers\": 0, \n"," \"path_to_save\": None, \n"," \"freeze_defaults\": True,\n"," \"cont_embedder\": 'plr',\n"," 'cat_embedder': 'weighted',\n"," 'act_fun': 'GELU',#'SiLU',\n"," \"hidden_size\": [64, 32], #32,\n"," 'stop_by_metric': True,\n"," 'embedding_size': 37,#32,\n"," 'verbose_bar': True,\n"," 'input_bn': False,\n"," 'opt_params': { 'lr': 0.0003 , 'weight_decay': 0 }\n"," },\n"," nn_pipeline_params = {\"use_qnt\": True, \"use_te\": False},\n"," reader_params = {'n_jobs': 12, 'cv': 10, 'random_state': 42, 'advanced_roles': False})\n","\n"," out_of_fold_predictions = automl1.fit_predict(\n"," x_tr, valid_data = x_vl, \n"," roles = {\n"," 'target': 'price',\n"," 'drop': ['id'],\n"," \n"," }, \n"," verbose = 1)\n"," values = np.array(list(automl1.reader.class_mapping.keys()))\n","\n"," oof[te_idx] = (out_of_fold_predictions.data @ values.reshape(-1, 1)).flatten()\n"," pred += (automl1.predict(test2).data @ values.reshape(-1, 1)).flatten() / 10\n"," pred_add += (automl1.predict(test2_add).data @ values.reshape(-1, 1)).flatten() / 10\n","\n"," models[fold] = automl1\n"," res_dl_cls = {'oof': oof, 'pred': pred, 'pred_add': pred_add, 'models': models}\n"," joblib.dump(res_dl_cls, f'denselight_cls_{clip_name}_{data_name}.jbl')\n"," print(f'denselight_cls_{clip_name}_{data_name}', np.sqrt(mean_squared_error(train2['price'], oof)))\n","\n"," # ftt classification\n"," task = Task('multiclass', metric=ll)\n"," oof = np.zeros(len(train2))\n"," pred = 0\n"," pred_add = 0\n"," models = {}\n"," if not os.path.isfile(f'ftt_cls_{clip_name}_{data_name}.jbl'):\n"," for fold, (tr_idx, te_idx) in enumerate(KFold(n_splits=10, random_state=42, shuffle=True).split(train2['price'], train2['price'], None)):\n"," x_tr, x_vl = train2.iloc[tr_idx].reset_index(drop=True), train2.iloc[te_idx].reset_index(drop=True)\n"," if add_data is not None:\n"," x_tr = pd.concat([x_tr, train2_add], axis=0).reset_index(drop=True)\n"," \n"," x_tr['price'] = np.clip(x_tr['price'], 0, clip)\n","\n"," x_tr['price'] = x_tr['price'].apply(myround )\n"," x_vl['price'] = x_vl['price'].apply(myround )\n","\n"," sorted_labels = np.array(sorted(np.unique(x_tr['price'])))\n"," sorted_labels2 = np.array(sorted(np.unique(x_vl['price'])))\n","\n"," mapping = {}\n"," for curr in sorted_labels2:\n"," diff = np.abs(sorted_labels - curr)\n"," idx = np.argmin(diff)\n"," mapping[curr] = sorted_labels[idx]\n"," x_vl['price'] = x_vl['price'].map(mapping)\n","\n"," automl1 = TabularAutoML(debug=True,\n"," task = task, \n"," timeout = 600 * 3600,\n"," cpu_limit = 2, \n"," gpu_ids = '0',\n"," selection_params = {'mode': 0},\n"," general_params = {\"use_algos\": [[FTT_plus]]}, \n"," nn_params = {\n"," \"n_epochs\": 20, \n"," \"bs\": 1024//2, \n"," \"num_workers\": 0, \n"," \"path_to_save\": None, \n"," \"freeze_defaults\": True,\n"," \"cont_embedder\": 'plr',\n"," 'cat_embedder': 'weighted',\n"," 'act_fun': 'GELU',#'SiLU',\n"," \"hidden_size\": [64, 32], #32,\n"," 'stop_by_metric': True,\n"," 'embedding_size': 128,#32,\n"," 'verbose_bar': True,\n"," 'input_bn': False,\n"," 'opt_params': { 'lr': 0.0003 , 'weight_decay': 0 }, \"model_with_emb\": True,\n"," },\n"," nn_pipeline_params = {\"use_qnt\": True, \"use_te\": False},\n"," reader_params = {'n_jobs': 12, 'cv': 10, 'random_state': 42, 'advanced_roles': False})\n","\n"," out_of_fold_predictions = automl1.fit_predict(\n"," x_tr, valid_data = x_vl, \n"," roles = {\n"," 'target': 'price',\n"," 'drop': ['id'],\n"," \n"," }, \n"," verbose = 1)\n"," \n"," values = np.array(list(automl1.reader.class_mapping.keys()))\n","\n"," oof[te_idx] = (out_of_fold_predictions.data @ values.reshape(-1, 1)).flatten()\n"," pred += (automl1.predict(test2).data @ values.reshape(-1, 1)).flatten() / 10\n"," pred_add += (automl1.predict(test2_add).data @ values.reshape(-1, 1)).flatten() / 10\n","\n"," models[fold] = automl1\n"," res_dl_cls = {'oof': oof, 'pred': pred, 'pred_add': pred_add, 'models': models}\n"," joblib.dump(res_dl_cls, f'ftt_cls_{clip_name}_{data_name}.jbl')\n"," print(f'ftt_cls_{clip_name}_{data_name}', np.sqrt(mean_squared_error(train2['price'], oof)))\n","\n"," # denselight regression\n"," task = Task('reg')\n"," oof = np.zeros(len(train2))\n"," pred = 0\n"," pred_add = 0\n"," models = {}\n"," if not os.path.isfile(f'denselight_reg_{clip_name}_{data_name}.jbl'):\n"," for fold, (tr_idx, te_idx) in enumerate(KFold(n_splits=10, random_state=42, shuffle=True).split(train2['price'], train2['price'], None)):\n"," x_tr, x_vl = train2.iloc[tr_idx].reset_index(drop=True), train2.iloc[te_idx].reset_index(drop=True)\n"," if add_data is not None:\n"," x_tr = pd.concat([x_tr, train2_add], axis=0).reset_index(drop=True)\n"," \n"," x_tr['price'] = np.clip(x_tr['price'], 0, clip)\n","\n"," scaler = RobustScaler()\n"," scaler.fit(x_tr['price'].values.reshape(-1, 1))\n"," x_tr['price'] = scaler.transform(x_tr['price'].values.reshape(-1, 1))\n"," x_vl['price'] = scaler.transform(x_vl['price'].values.reshape(-1, 1))\n","\n"," automl1 = TabularAutoML(debug=True,\n"," task = task, \n"," timeout = 600 * 3600,\n"," cpu_limit = 2, \n"," gpu_ids = '0',\n"," selection_params = {'mode': 0},\n"," general_params = {\"use_algos\": [['denselight']]}, \n"," nn_params = {\n"," \"n_epochs\": 10, \n"," \"bs\": 1024//2, \n"," \"num_workers\": 0, \n"," \"path_to_save\": None, \n"," \"freeze_defaults\": True,\n"," \"cont_embedder\": 'plr',\n"," 'cat_embedder': 'weighted',\n"," 'act_fun': 'GELU',#'SiLU',\n"," \"hidden_size\": [64, 32], #32,\n"," 'stop_by_metric': True,\n"," 'embedding_size': 37,#32,\n"," 'verbose_bar': True,\n"," 'input_bn': False,\n"," 'opt_params': { 'lr': 0.0003 , 'weight_decay': 0 }\n"," },\n"," nn_pipeline_params = {\"use_qnt\": True, \"use_te\": False},\n"," reader_params = {'n_jobs': 12, 'cv': 10, 'random_state': 42, 'advanced_roles': False})\n","\n"," out_of_fold_predictions = automl1.fit_predict(\n"," x_tr, valid_data = x_vl, \n"," roles = {\n"," 'target': 'price',\n"," 'drop': ['id'],\n"," \n"," }, \n"," verbose = 1)\n"," oof[te_idx] = scaler.inverse_transform(out_of_fold_predictions.data.flatten().reshape(-1, 1)).flatten()\n"," pred += scaler.inverse_transform(automl1.predict(test2).data.flatten().reshape(-1, 1)).flatten() / 10\n"," pred_add += scaler.inverse_transform(automl1.predict(test2_add).data.flatten().reshape(-1, 1)).flatten() / 10\n","\n"," models[fold] = automl1\n"," res_dl_r = {'oof': oof, 'pred': pred, 'pred_add': pred_add, 'models': models}\n"," joblib.dump(res_dl_r, f'denselight_reg_{clip_name}_{data_name}.jbl')\n"," print(f'denselight_reg_{clip_name}_{data_name}', np.sqrt(mean_squared_error(train2['price'], oof)))\n","\n"," # ftt regression\n"," task = Task('reg')\n"," oof = np.zeros(len(train2))\n"," pred = 0\n"," pred_add = 0\n"," models = {}\n"," if not os.path.isfile(f'ftt_reg_{clip_name}_{data_name}.jbl'):\n"," for fold, (tr_idx, te_idx) in enumerate(KFold(n_splits=10, random_state=42, shuffle=True).split(train2['price'], train2['price'], None)):\n"," x_tr, x_vl = train2.iloc[tr_idx].reset_index(drop=True), train2.iloc[te_idx].reset_index(drop=True)\n"," if add_data is not None:\n"," x_tr = pd.concat([x_tr, train2_add], axis=0).reset_index(drop=True)\n"," \n"," x_tr['price'] = np.clip(x_tr['price'], 0, clip)\n","\n"," scaler = RobustScaler()\n"," scaler.fit(x_tr['price'].values.reshape(-1, 1))\n"," x_tr['price'] = scaler.transform(x_tr['price'].values.reshape(-1, 1))\n"," x_vl['price'] = scaler.transform(x_vl['price'].values.reshape(-1, 1))\n","\n"," automl1 = TabularAutoML(debug=True,\n"," task = task, \n"," timeout = 600 * 3600,\n"," cpu_limit = 2, \n"," gpu_ids = '0',\n"," selection_params = {'mode': 0},\n"," general_params = {\"use_algos\": [[FTT_plus]]}, \n"," nn_params = {\n"," \"n_epochs\": 10, \n"," \"bs\": 1024//2, \n"," \"num_workers\": 0, \n"," \"path_to_save\": None, \n"," \"freeze_defaults\": True,\n"," \"cont_embedder\": 'plr',\n"," 'cat_embedder': 'weighted',\n"," 'act_fun': 'GELU',#'SiLU',\n"," \"hidden_size\": [64, 32], #32,\n"," 'stop_by_metric': True,\n"," 'embedding_size': 128,#128 - tiny, 512 - small ,#32,\n"," 'verbose_bar': True,\n"," #'init_bias': False,\n"," 'input_bn': False,\n"," #'sch': 'CosineAnnealingLR',\n"," #'scheduler_params': { 'T_max': 10, 'eta_min':0, 'last_epoch':-1, 'verbose':None},\n"," #\"snap_params\": { 'k': 3, 'early_stopping': True, 'patience': 3, 'swa': False }, \n"," 'opt_params': { 'lr': 0.0003 , 'weight_decay': 0 },\n"," \"model_with_emb\": True,\n"," },nn_pipeline_params = {\"use_qnt\": True, \"use_te\": False},\n"," reader_params = {'n_jobs': 12, 'cv': 10, 'random_state': 42, 'advanced_roles': False})\n"," \n","\n"," out_of_fold_predictions = automl1.fit_predict(\n"," x_tr, valid_data = x_vl, \n"," roles = {\n"," 'target': 'price',\n"," 'drop': ['id'],\n"," \n"," }, \n"," verbose = 1)\n"," oof[te_idx] = scaler.inverse_transform(out_of_fold_predictions.data.flatten().reshape(-1, 1)).flatten()\n"," pred += scaler.inverse_transform(automl1.predict(test2).data.flatten().reshape(-1, 1)).flatten() / 10\n"," pred_add += scaler.inverse_transform(automl1.predict(test2_add).data.flatten().reshape(-1, 1)).flatten() / 10\n","\n"," models[fold] = automl1\n"," res_dl_r = {'oof': oof, 'pred': pred, 'pred_add': pred_add, 'models': models}\n"," joblib.dump(res_dl_r, f'ftt_reg_{clip_name}_{data_name}.jbl')\n"," print(f'ftt_reg_{clip_name}_{data_name}', np.sqrt(mean_squared_error(train2['price'], oof)))\n","\n"," # catboost regression\n"," task = Task('reg')\n"," oof = np.zeros(len(train2))\n"," pred = 0\n"," pred_add = 0\n"," models = {}\n"," if not os.path.isfile(f'catboost_{clip_name}_{data_name}.jbl'):\n"," for fold, (tr_idx, te_idx) in enumerate(KFold(n_splits=10, random_state=42, shuffle=True).split(train2['price'], train2['price'], None)):\n"," x_tr, x_vl = train2.iloc[tr_idx].reset_index(drop=True), train2.iloc[te_idx].reset_index(drop=True)\n"," if add_data is not None:\n"," x_tr = pd.concat([x_tr, train2_add], axis=0).reset_index(drop=True)\n"," \n"," x_tr['price'] = np.clip(x_tr['price'], 0, clip)\n","\n"," automl1 = TabularAutoML(debug=True,\n"," task = task, \n"," timeout = 600 * 3600,\n"," cpu_limit = 2,\n"," gpu_ids = '0',\n"," selection_params = {'mode': 0},\n"," general_params = {\"use_algos\": [['cb']]},\n"," cb_params = {'default_params': cb_params,\n"," 'freeze_defaults': True},\n"," reader_params = {'n_jobs': 12, 'cv': 10, 'random_state': 42, 'advanced_roles': True})\n","\n"," out_of_fold_predictions = automl1.fit_predict(\n"," x_tr, valid_data = x_vl, \n"," roles = {\n"," 'target': 'price',\n"," 'drop': ['id'],\n"," \n"," }, \n"," verbose = 1)\n"," oof[te_idx] = out_of_fold_predictions.data.flatten()\n"," pred += automl1.predict(test2).data.flatten() / 10\n"," pred_add += automl1.predict(test2_add).data.flatten() / 10\n","\n"," models[fold] = automl1\n"," res_catboost = {'oof': oof, 'pred': pred, 'pred_add': pred_add, 'models': models}\n"," joblib.dump(res_catboost, f'catboost_{clip_name}_{data_name}.jbl')\n","\n"," print(f'catboost_{clip_name}_{data_name}', np.sqrt(mean_squared_error(train2['price'], oof)))\n","\n","\n"," # lgb regression\n"," task = Task('reg')\n"," oof = np.zeros(len(train2))\n"," pred = 0\n"," pred_add = 0\n"," models = {}\n"," if not os.path.isfile(f'lgb_{clip_name}_{data_name}.jbl'):\n"," for fold, (tr_idx, te_idx) in enumerate(KFold(n_splits=10, random_state=42, shuffle=True).split(train2['price'], train2['price'], None)):\n"," x_tr, x_vl = train2.iloc[tr_idx].reset_index(drop=True), train2.iloc[te_idx].reset_index(drop=True)\n"," if add_data is not None:\n"," x_tr = pd.concat([x_tr, train2_add], axis=0).reset_index(drop=True)\n"," \n"," x_tr['price'] = np.clip(x_tr['price'], 0, clip)\n","\n"," automl1 = TabularAutoML(debug=True,\n"," task = task, \n"," timeout = 600 * 3600,\n"," cpu_limit = 2,\n"," gpu_ids = '0',\n"," selection_params = {'mode': 0},\n"," general_params = {\"use_algos\": [['lgb']]},\n"," lgb_params = {'default_params': lgb_params,\n"," 'freeze_defaults': True},\n"," reader_params = {'n_jobs': 12, 'cv': 10, 'random_state': 42, 'advanced_roles': True})\n","\n"," out_of_fold_predictions = automl1.fit_predict(\n"," x_tr, valid_data = x_vl, \n"," roles = {\n"," 'target': 'price',\n"," 'drop': ['id'],\n"," \n"," }, \n"," verbose = 1)\n"," oof[te_idx] = out_of_fold_predictions.data.flatten()\n"," pred += automl1.predict(test2).data.flatten() / 10\n"," pred_add += automl1.predict(test2_add).data.flatten() / 10\n","\n"," models[fold] = automl1\n"," res_lgb = {'oof': oof, 'pred': pred, 'pred_add': pred_add, 'models': models}\n"," joblib.dump(res_lgb, f'lgb_{clip_name}_{data_name}.jbl')\n"," print(f'lgb_{clip_name}_{data_name}', np.sqrt(mean_squared_error(train2['price'], oof)))\n","\n","\n"]}],"metadata":{"kaggle":{"accelerator":"gpu","dataSources":[{"databundleVersionId":8930475,"sourceId":73291,"sourceType":"competition"}],"dockerImageVersionId":30733,"isGpuEnabled":true,"isInternetEnabled":true,"language":"python","sourceType":"notebook"},"kernelspec":{"display_name":"icecube_jup","language":"python","name":"icecube"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.8.16"}},"nbformat":4,"nbformat_minor":4} 2 | -------------------------------------------------------------------------------- /TPS_lightautoml_blend.ipynb: -------------------------------------------------------------------------------- 1 | {"cells":[{"cell_type":"code","execution_count":null,"metadata":{"execution":{"iopub.execute_input":"2024-07-18T17:24:13.038257Z","iopub.status.busy":"2024-07-18T17:24:13.037557Z","iopub.status.idle":"2024-07-18T17:24:49.042400Z","shell.execute_reply":"2024-07-18T17:24:49.041283Z","shell.execute_reply.started":"2024-07-18T17:24:13.038204Z"},"trusted":true},"outputs":[],"source":["# Essential DS libraries\n","import numpy as np\n","import pandas as pd\n","import gc\n","from sklearn.metrics import roc_auc_score, mean_squared_error\n","from sklearn.model_selection import train_test_split\n","\n","# LightAutoML presets, task and report generation\n","from lightautoml.automl.presets.tabular_presets import TabularAutoML\n","from lightautoml.tasks import Task\n","\n","pd.set_option('display.max_columns', 50)"]},{"cell_type":"code","execution_count":9,"metadata":{},"outputs":[],"source":["from sklearn.preprocessing import StandardScaler, MinMaxScaler, RobustScaler\n","from lightautoml.text.nn_model import TorchUniversalModel\n","from lightautoml.text.embed import PLREmbedding, WeightedCatEmbedding, pooling_by_name\n","from lightautoml.ml_algo.torch_based.fttransformer.fttransformer_utils import Transformer\n","from collections import OrderedDict\n","from typing import List, Tuple, Type\n","from typing import Optional\n","from typing import Union\n","\n","import numpy as np\n","import torch\n","import torch.nn as nn\n","\n","from lightautoml.text.nn_model import TorchUniversalModel\n","from lightautoml.text.embed import PLREmbedding, WeightedCatEmbedding, pooling_by_name\n","from lightautoml.ml_algo.torch_based.fttransformer.fttransformer_utils import Transformer\n","from collections import OrderedDict\n","from typing import List, Tuple, Type\n","from typing import Optional\n","from typing import Union\n","\n","import numpy as np\n","import torch\n","import torch.nn as nn\n","\n","from transformers import BertConfig, BertModel, BertForSequenceClassification\n","from peft import get_peft_config, get_peft_model, LoraConfig, TaskType\n","\n","class BertEmbeddingsEmpty(nn.Module):\n"," \"\"\"Construct the embeddings from word, position and token_type embeddings.\"\"\"\n","\n"," def __init__(self):\n"," super().__init__()\n","\n"," # self.LayerNorm is not snake-cased to stick with TensorFlow model variable name and be able to load\n"," # any TensorFlow checkpoint file\n","\n","\n"," def forward(self, input_ids=None, token_type_ids=None, position_ids=None, inputs_embeds=None, **kwargs):\n"," if input_ids is not None:\n"," input_shape = input_ids.size()\n"," else:\n"," input_shape = inputs_embeds.size()[:-1]\n","\n"," seq_length = input_shape[1]\n","\n"," embeddings = inputs_embeds\n"," return embeddings\n","class FTTransformer2(nn.Module):\n"," \"\"\"FT Transformer (https://arxiv.org/abs/2106.11959v2) from https://github.com/lucidrains/tab-transformer-pytorch/tree/main.\n","\n"," Args:\n"," pooling: Pooling used for the last step.\n"," n_out: Output dimension, 1 for binary prediction.\n"," embedding_size: Embeddings size.\n"," depth: Number of Attention Blocks inside Transformer.\n"," heads: Number of heads in Attention.\n"," attn_dropout: Post-Attention dropout.\n"," ff_dropout: Feed-Forward Dropout.\n"," dim_head: Attention head dimension.\n"," num_enc_layers: Number of Transformer layers.\n"," device: Device to compute on.\n"," \"\"\"\n","\n"," def __init__(\n"," self,\n"," *,\n"," pooling: str = \"mean\",\n"," n_out: int = 1,\n"," embedding_size: int = 32,\n"," depth: int = 4,\n"," heads: int = 1,\n"," attn_dropout: float = 0.1,\n"," ff_dropout: float = 0.1,\n"," dim_head: int = 32,\n"," num_enc_layers: int = 2,\n"," device: Union[str, torch.device] = \"cuda:0\",\n"," **kwargs,\n"," ):\n"," super(FTTransformer2, self).__init__()\n"," self.device = device\n"," self.pooling = pooling_by_name[pooling]()\n"," print('pooling', pooling)\n"," \n"," # transformer\n"," # self.transformer = nn.Sequential(\n"," # *nn.ModuleList(\n"," # [\n"," # Transformer(\n"," # dim=embedding_size,\n"," # depth=depth,\n"," # heads=heads,\n"," # dim_head=dim_head,\n"," # attn_dropout=attn_dropout,\n"," # ff_dropout=ff_dropout,\n"," # )\n"," # for _ in range(num_enc_layers)\n"," # ]\n"," # )\n"," # )\n"," self.conf = {\"hidden_size\": 128, \"hidden_act\": \"gelu\", \"initializer_range\": 0.02, \"vocab_size\": 10, \"hidden_dropout_prob\": 0.1, \"num_attention_heads\": 2,\n"," \"type_vocab_size\": 2, \"max_position_embeddings\": 512, \"num_hidden_layers\": 2, \"intermediate_size\": 512, \"attention_probs_dropout_prob\": 0.1} #bert_tiny\n"," # self.conf = {\"hidden_size\": 512, \"hidden_act\": \"gelu\", \"initializer_range\": 0.02, \"vocab_size\": 10, \"hidden_dropout_prob\": 0.1, \"num_attention_heads\": 8,\n"," # \"type_vocab_size\": 2, \"max_position_embeddings\": 512, \"num_hidden_layers\": 4, \"intermediate_size\": 2048, \"attention_probs_dropout_prob\": 0.1} #bert_small\n","\n"," #self.transformer = BertModel(BertConfig(**self.conf))\n"," self.transformer = BertModel.from_pretrained(\"prajjwal1/bert-tiny\", output_attentions=True, output_hidden_states=True, cache_dir=\"./\")\n"," self.transformer.embeddings = BertEmbeddingsEmpty()\n","\n"," #peft_config = LoraConfig(task_type=TaskType.FEATURE_EXTRACTION, inference_mode=False, r=8, lora_alpha=32, lora_dropout=0.1)\n","\n"," #self.transformer = get_peft_model(self.transformer, peft_config)\n"," #print(self.transformer.print_trainable_parameters())\n","\n"," #self.fixup_initialization()\n"," # to logits\n"," \n"," self.to_logits = nn.Sequential(nn.BatchNorm1d(embedding_size), nn.Linear(embedding_size, n_out))\n","\n"," self.cls_token = nn.Embedding(2, embedding_size)\n","\n"," def fixup_initialization(self):\n"," temp_state_dic = {}\n"," en_layers = self.conf['num_hidden_layers']\n","\n"," for name, param in self.named_parameters():\n"," if 'weight' in name and param.data.dim() == 2:\n"," param = (9 * en_layers) ** (- 1 / 4) * param\n"," temp_state_dic[name] = param\n"," if np.any([1 if i in name else 0 for i in [\"linear1.weight\",\n"," \"linear2.weight\",\n"," \"self_attn.out_proj.weight\", #'self_attn.in_proj_weight', \n"," ]]):\n"," temp_state_dic[name] = (0.67 * (en_layers) ** (- 1. / 4.)) * param\n"," elif name in [\"self_attn.v_proj.weight\",]:\n"," temp_state_dic[name] = (0.67 * (en_layers) ** (- 1. / 4.)) * (param * (2**0.5))\n","\n"," for name in self.state_dict():\n"," if name not in temp_state_dic:\n"," temp_state_dic[name] = self.state_dict()[name]\n"," self.load_state_dict(temp_state_dic)\n","\n"," def forward(self, embedded):\n"," \"\"\"Transform the input tensor.\n","\n"," Args:\n"," embedded : torch.Tensor\n"," embedded fields\n","\n"," Returns:\n"," torch.Tensor\n","\n"," \"\"\"\n"," cls_token = torch.unsqueeze(\n"," self.cls_token(torch.ones(embedded.shape[0], dtype=torch.int).to(self.device)), dim=1\n"," )\n"," x = torch.cat((cls_token, embedded), dim=1)\n","\n"," x = self.transformer(inputs_embeds=x, \n"," #attention_mask=~mask\n"," ).last_hidden_state\n"," #x = self.transformer(x)\n"," x_mask = torch.ones(x.shape, dtype=torch.bool).to(self.device)\n"," pool_tokens = self.pooling(x=x, x_mask=x_mask)\n"," logits = self.to_logits(pool_tokens)\n"," return logits\n","\n","\n","class FTT_plus(TorchUniversalModel):\n"," \"\"\"Mixed data model.\n","\n"," Class for preparing input for DL model with mixed data.\n","\n"," Args:\n"," n_out: Number of output dimensions.\n"," cont_params: Dict with numeric model params.\n"," cat_params: Dict with category model para\n"," **kwargs: Loss, task and other parameters.\n","\n"," \"\"\"\n","\n"," def __init__(\n"," self,\n"," n_out: int = 1,\n"," cont_params = None,\n"," cat_params = None,\n"," **kwargs,\n"," ):\n"," # init parent class (need some helper functions to be used)\n"," super(FTT_plus, self).__init__(**{\n"," **kwargs,\n"," \"cont_params\": cont_params,\n"," \"cat_params\": cat_params,\n"," \"torch_model\": None, # dont need any model inside parent class\n"," })\n"," \n"," n_in = 0\n"," # add cont columns processing\n"," self.cont_embedder = PLREmbedding(**cont_params)\n"," n_in += self.cont_embedder.get_out_shape()\n"," \n"," # add cat columns processing\n"," self.cat_embedder = WeightedCatEmbedding(**cat_params)\n"," n_in += self.cat_embedder.get_out_shape()\n"," \n"," self.torch_model = FTTransformer2(\n"," **{\n"," **kwargs,\n"," **{\"n_in\": n_in, \"n_out\": n_out},\n"," }\n"," )\n"," \n"," def get_logits(self, inp) -> torch.Tensor:\n"," outputs = []\n"," outputs.append(self.cont_embedder(inp))\n"," outputs.append(self.cat_embedder(inp))\n"," \n"," if len(outputs) > 1:\n"," output = torch.cat(outputs, dim=1)\n"," else:\n"," output = outputs[0]\n"," \n"," logits = self.torch_model(output)\n"," return logits\n","\n","def myround(x, base=1000):\n"," return base * np.round(np.float32(x) / base)"]},{"cell_type":"code","execution_count":2,"metadata":{"execution":{"iopub.execute_input":"2024-07-18T16:46:17.568031Z","iopub.status.busy":"2024-07-18T16:46:17.567603Z","iopub.status.idle":"2024-07-18T16:46:54.971281Z","shell.execute_reply":"2024-07-18T16:46:54.970299Z","shell.execute_reply.started":"2024-07-18T16:46:17.567998Z"},"trusted":true},"outputs":[{"data":{"text/html":["
\n","\n","\n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n","
idbrandmodelmodel_yearmilagefuel_typeenginetransmissionext_colint_colaccidentclean_titleprice
00MINICooper S Base2007213000Gasoline172.0HP 1.6L 4 Cylinder Engine Gasoline FuelA/TYellowGrayNone reportedYes4200
11LincolnLS V82002143250Gasoline252.0HP 3.9L 8 Cylinder Engine Gasoline FuelA/TSilverBeigeAt least 1 accident or damage reportedYes4999
22ChevroletSilverado 2500 LT2002136731E85 Flex Fuel320.0HP 5.3L 8 Cylinder Engine Flex Fuel Capab...A/TBlueGrayNone reportedYes13900
33GenesisG90 5.0 Ultimate201719500Gasoline420.0HP 5.0L 8 Cylinder Engine Gasoline FuelTransmission w/Dual Shift ModeBlackBlackNone reportedYes45000
44Mercedes-BenzMetris Base20217388Gasoline208.0HP 2.0L 4 Cylinder Engine Gasoline Fuel7-Speed A/TBlackBeigeNone reportedYes97500
\n","
"],"text/plain":[" id brand model model_year milage fuel_type \\\n","0 0 MINI Cooper S Base 2007 213000 Gasoline \n","1 1 Lincoln LS V8 2002 143250 Gasoline \n","2 2 Chevrolet Silverado 2500 LT 2002 136731 E85 Flex Fuel \n","3 3 Genesis G90 5.0 Ultimate 2017 19500 Gasoline \n","4 4 Mercedes-Benz Metris Base 2021 7388 Gasoline \n","\n"," engine \\\n","0 172.0HP 1.6L 4 Cylinder Engine Gasoline Fuel \n","1 252.0HP 3.9L 8 Cylinder Engine Gasoline Fuel \n","2 320.0HP 5.3L 8 Cylinder Engine Flex Fuel Capab... \n","3 420.0HP 5.0L 8 Cylinder Engine Gasoline Fuel \n","4 208.0HP 2.0L 4 Cylinder Engine Gasoline Fuel \n","\n"," transmission ext_col int_col \\\n","0 A/T Yellow Gray \n","1 A/T Silver Beige \n","2 A/T Blue Gray \n","3 Transmission w/Dual Shift Mode Black Black \n","4 7-Speed A/T Black Beige \n","\n"," accident clean_title price \n","0 None reported Yes 4200 \n","1 At least 1 accident or damage reported Yes 4999 \n","2 None reported Yes 13900 \n","3 None reported Yes 45000 \n","4 None reported Yes 97500 "]},"execution_count":2,"metadata":{},"output_type":"execute_result"}],"source":["train = pd.read_csv('data/train.csv')\n","test = pd.read_csv('data/test.csv')\n","\n","train.head()"]},{"cell_type":"code","execution_count":4,"metadata":{},"outputs":[],"source":["train_add = pd.read_csv('data/train_add.csv')\n","\n","all_data = pd.concat([train, train_add, test]).reset_index(drop = True)\n","all_data.head()\n","\n","def convert_engine(val):\n"," d = {\n"," 'engine_HP': np.nan,\n"," 'engine_L': np.nan,\n"," 'engine_cylinder': np.nan,\n"," 'engine_cylinder_type': np.nan,\n"," 'engine_fuel_type': np.nan,\n"," 'engine_type': np.nan,\n"," 'engine_v': np.nan,\n"," 'engine_vtype': np.nan\n"," }\n"," spl = val.replace('-', '').split(' ')\n"," pos_v1 = -1\n"," pos_v2 = -1\n"," for i, v in enumerate(spl):\n"," if v.endswith('HP'):\n"," d['engine_HP'] = float(v[:-2])\n"," elif v.endswith('L'):\n"," d['engine_L'] = float(v[:-1])\n"," elif v == 'Engine' and spl[i-1] == 'Cylinder':\n"," d['engine_cylinder'] = abs(float(spl[i-2].replace('V', '')))\n"," elif v == 'Fuel':\n"," d['engine_fuel_type'] = spl[i - 1]\n"," ##############\n"," elif v == 'Liter':\n"," d['engine_L'] = float(spl[i-1])\n"," elif v.startswith('V') or v.startswith('H') or v.startswith('I'):\n"," try:\n"," d['engine_cylinder'] = float(v[1:])\n"," d['engine_cylinder_type'] = v[0]\n"," pos_v1 = i\n"," except:\n"," pass\n"," elif v == 'DOHC' or v == 'OHV':\n"," d['engine_type'] = ' '.join(spl[i:])\n"," if pos_v2 != -1:\n"," d['engine_vtype'] = ' '.join(spl[pos_v2+1:i])\n"," elif pos_v1 != -1:\n"," d['engine_vtype'] = ' '.join(spl[pos_v1+1:i])\n"," elif v.endswith('V'):\n"," try:\n"," d['engine_v'] = float(v[:-1])\n"," pos_v2 = i\n"," except:\n"," pass\n"," return d\n","\n","all_data = pd.concat([all_data, pd.DataFrame.from_records(all_data['engine'].map(convert_engine).values)], axis = 1)\n","def milage_signs(val):\n"," v = str(val)\n"," for i in range(len(v) - 1, -1, -1):\n"," if v[i] != '0':\n"," break\n"," return (len(v) - 1 - i) / len(v) * 100\n","\n","\n","all_data['milage_signif_signs_perc'] = all_data['milage'].map(milage_signs)\n","for col in ['transmission', 'ext_col', 'int_col']:\n"," all_data[col] = all_data[col].str.lower()\n","\n","def convert_transmission(val):\n"," d = {\n"," 'transmission_speeds_cnt': np.nan,\n"," 'transmission_type': np.nan\n"," }\n"," spl = val.replace('/', '').split(' ')\n"," for i, v in enumerate(spl):\n"," if 'speed' in v:\n"," tmp = v.split('-')\n"," if len(tmp) > 1:\n"," if tmp[0] != 'single':\n"," d['transmission_speeds_cnt'] = float(tmp[0])\n"," else:\n"," d['transmission_speeds_cnt'] = 1.0\n"," else:\n"," d['transmission_speeds_cnt'] = float(spl[i-1])\n"," elif 'manual' in v or 'mt' in v:\n"," d['transmission_type'] = 'manual'\n"," elif 'automatic' in v or 'at' in v:\n"," d['transmission_type'] = 'automatic'\n"," return d\n","\n","all_data = pd.concat([all_data, pd.DataFrame.from_records(all_data['transmission'].map(convert_transmission).values)], axis = 1)\n","\n","# all_data['mileage_year_delta_mean'] = all_data['milage'] - all_data['model_year'].map(all_data.groupby(['model_year'])['milage'].mean())\n","# all_data['mileage_year_delta_median'] = all_data['milage'] - all_data['model_year'].map(all_data.groupby(['model_year'])['milage'].median())\n","\n","# all_data['tmp'] = (all_data['brand'].astype(str) + '_' + all_data['model_year'].astype(str))\n","# all_data['mileage_brandyear_delta_mean'] = all_data['milage'] - all_data['tmp'].map(all_data.groupby(['tmp'])['milage'].mean())\n","# all_data['mileage_brandyear_delta_median'] = all_data['milage'] - all_data['tmp'].map(all_data.groupby(['tmp'])['milage'].median())\n","\n","# all_data.drop(columns = ['tmp'], inplace = True)\n","\n","\n","train2, train2_add, test2 = all_data.iloc[:len(train)], all_data.iloc[len(train):len(train)+len(train_add)], all_data.iloc[len(train)+len(train_add):]\n","X_train2, X_val2 = train_test_split(train2, test_size=0.2, random_state=42, shuffle=True, stratify=train['price'])\n"]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["import joblib\n","from sklearn.metrics import log_loss\n","def ll(x, y):\n"," return log_loss(x, y, labels=np.arange(y.shape[1]))\n","\n","cb_woclip_data = joblib.load('catboost_woclip_data.jbl')\n","cb_woclip_wodata = joblib.load('catboost_woclip_wodata.jbl')\n","\n","cb_clip_data = joblib.load('catboost_clip_data.jbl')\n","cb_clip_wodata = joblib.load('catboost_clip_wodata.jbl')\n","\n","lgb_woclip_data = joblib.load('lgb_woclip_data.jbl')\n","lgb_woclip_wodata = joblib.load('lgb_woclip_wodata.jbl')\n","\n","lgb_clip_data = joblib.load('lgb_clip_data.jbl')\n","lgb_clip_wodata = joblib.load('lgb_clip_wodata.jbl')\n","\n","dl_cls_woclip_data = joblib.load('denselight_cls_woclip_data.jbl')\n","dl_cls_woclip_wodata = joblib.load('denselight_cls_woclip_wodata.jbl')\n","dl_reg_woclip_data = joblib.load('denselight_reg_woclip_data.jbl')\n","dl_reg_woclip_wodata = joblib.load('denselight_reg_woclip_wodata.jbl')\n","\n","dl_cls_clip_data = joblib.load('denselight_cls_clip_data.jbl')\n","dl_cls_clip_wodata = joblib.load('denselight_cls_clip_wodata.jbl')\n","dl_reg_clip_data = joblib.load('denselight_reg_clip_data.jbl')\n","dl_reg_clip_wodata = joblib.load('denselight_reg_clip_wodata.jbl')\n","\n","ftt_cls_woclip_data = joblib.load('ftt_cls_woclip_data.jbl')\n","ftt_cls_woclip_wodata = joblib.load('ftt_cls_woclip_wodata.jbl')\n","ftt_reg_woclip_data = joblib.load('ftt_reg_woclip_data.jbl')\n","ftt_reg_woclip_wodata = joblib.load('ftt_reg_woclip_wodata.jbl')\n","\n","ftt_cls_clip_data = joblib.load('ftt_cls_clip_data.jbl')\n","ftt_cls_clip_wodata = joblib.load('ftt_cls_clip_wodata.jbl')\n","ftt_reg_clip_data = joblib.load('ftt_reg_clip_data.jbl')\n","ftt_reg_clip_wodata = joblib.load('ftt_reg_clip_wodata.jbl')"]},{"cell_type":"code","execution_count":126,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["cb_woclip_data 72618.9703478578\n","cb_woclip_wodata 72668.7328880977\n","cb_clip_data 72570.46991893183\n","cb_clip_wodata 72600.88262678128\n","========\n","lgb_woclip_data 72602.41078032415\n","lgb_woclip_wodata 72620.9594297133\n","lgb_clip_data 72601.86760677746\n","lgb_clip_wodata 72596.83126323734\n","========\n","dl_cls_woclip_data 72511.68695240283\n","dl_cls_woclip_wodata 72533.1908545782\n","dl_reg_woclip_data 72590.25331475686\n","dl_reg_woclip_wodata 72595.92306687857\n","dl_cls_clip_data 72592.14593018906\n","dl_cls_clip_wodata 72602.7694385295\n","dl_reg_clip_data 72587.226643284\n","dl_reg_clip_wodata 72592.09624284969\n","========\n","ftt_cls_woclip_data 72588.59375538873\n","ftt_cls_woclip_wodata 72624.15051167678\n","ftt_reg_woclip_data 72929.32519290179\n","ftt_reg_woclip_wodata 72895.44063224178\n","ftt_cls_clip_data 72609.67167200606\n","ftt_cls_clip_wodata 72630.22898181618\n","ftt_reg_clip_data 72674.23620941052\n","ftt_reg_clip_wodata 72674.24512099774\n","========\n"]}],"source":["print('cb_woclip_data', np.sqrt(mean_squared_error(train['price'],cb_woclip_data['oof'])))\n","print('cb_woclip_wodata',np.sqrt(mean_squared_error(train['price'],cb_woclip_wodata['oof'])))\n","\n","print('cb_clip_data', np.sqrt(mean_squared_error(train['price'],cb_clip_data['oof'])))\n","print('cb_clip_wodata',np.sqrt(mean_squared_error(train['price'],cb_clip_wodata['oof'])))\n","\n","print('========')\n","\n","print('lgb_woclip_data', np.sqrt(mean_squared_error(train['price'],lgb_woclip_data['oof'])))\n","print('lgb_woclip_wodata', np.sqrt(mean_squared_error(train['price'],lgb_woclip_wodata['oof'])))\n","\n","print('lgb_clip_data', np.sqrt(mean_squared_error(train['price'],lgb_clip_data['oof'])))\n","print('lgb_clip_wodata', np.sqrt(mean_squared_error(train['price'],lgb_clip_wodata['oof'])))\n","\n","print('========')\n","\n","\n","print('dl_cls_woclip_data', np.sqrt(mean_squared_error(train['price'],dl_cls_woclip_data['oof'])))\n","print('dl_cls_woclip_wodata', np.sqrt(mean_squared_error(train['price'],dl_cls_woclip_wodata['oof'])))\n","print('dl_reg_woclip_data', np.sqrt(mean_squared_error(train['price'],dl_reg_woclip_data['oof'])))\n","print('dl_reg_woclip_wodata', np.sqrt(mean_squared_error(train['price'],dl_reg_woclip_wodata['oof'])))\n","\n","print('dl_cls_clip_data', np.sqrt(mean_squared_error(train['price'],dl_cls_clip_data['oof'])))\n","print('dl_cls_clip_wodata', np.sqrt(mean_squared_error(train['price'],dl_cls_clip_wodata['oof'])))\n","print('dl_reg_clip_data', np.sqrt(mean_squared_error(train['price'],dl_reg_clip_data['oof'])))\n","print('dl_reg_clip_wodata', np.sqrt(mean_squared_error(train['price'],dl_reg_clip_wodata['oof'])))\n","\n","print('========')\n","\n","\n","print('ftt_cls_woclip_data', np.sqrt(mean_squared_error(train['price'],ftt_cls_woclip_data['oof'])))\n","print('ftt_cls_woclip_wodata', np.sqrt(mean_squared_error(train['price'],ftt_cls_woclip_wodata['oof'])))\n","print('ftt_reg_woclip_data', np.sqrt(mean_squared_error(train['price'],ftt_reg_woclip_data['oof'])))\n","print('ftt_reg_woclip_wodata', np.sqrt(mean_squared_error(train['price'],ftt_reg_woclip_wodata['oof'])))\n","\n","print('ftt_cls_clip_data', np.sqrt(mean_squared_error(train['price'],ftt_cls_clip_data['oof'])))\n","print('ftt_cls_clip_wodata', np.sqrt(mean_squared_error(train['price'],ftt_cls_clip_wodata['oof'])))\n","print('ftt_reg_clip_data', np.sqrt(mean_squared_error(train['price'],ftt_reg_clip_data['oof'])))\n","print('ftt_reg_clip_wodata', np.sqrt(mean_squared_error(train['price'],ftt_reg_clip_wodata['oof'])))\n","\n","print('========')\n"]},{"cell_type":"code","execution_count":154,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["============ clip ===========\n","cb_blend1 72562.41639936849\n","lgb_blend1 72577.25042227953\n","dl_reg_blend1 72570.4577558202\n","dl_cls_blend1 72576.6460432608\n","ftt_reg_blend1 72630.82437226783\n","ftt_cls_blend1 72590.73705499641\n","gbm_blend1 72537.53694244122\n","dl_blend1 72525.34974947025\n","ftt_blend1 72535.56219749196\n","all_blend1 72482.96183545176\n","============ no clip ===========\n","cb_blend 72603.17802993162\n","lgb_blend 72577.56619206312\n","dl_reg_blend 72554.10550246558\n","dl_cls_blend 72493.64674517023\n","ftt_reg_blend 72826.89400857108\n","ftt_cls_blend 72562.48338206876\n","gbm_blend 72510.79114053813\n","dl_blend 72431.63394545649\n","ftt_blend 72487.94472391986\n","all_blend 72409.36716955696\n","============ final ===========\n"]}],"source":["print('============ clip ===========')\n","\n","\n","cb_blend1 = 0.7*cb_clip_data['oof'] + 0.3*cb_clip_wodata['oof']\n","print('cb_blend1', np.sqrt(mean_squared_error(train['price'],cb_blend1)))\n","\n","lgb_blend1 = 0.5*lgb_clip_data['oof'] + 0.5*lgb_clip_wodata['oof']\n","print('lgb_blend1', np.sqrt(mean_squared_error(train['price'],lgb_blend1)))\n","\n","dl_reg_blend1 = 0.4*dl_reg_clip_data['oof'] + 0.6*dl_reg_clip_wodata['oof']\n","print('dl_reg_blend1', np.sqrt(mean_squared_error(train['price'],dl_reg_blend1)))\n","\n","dl_cls_blend1 = 0.6*dl_cls_clip_data['oof'] + 0.4*dl_cls_clip_wodata['oof']\n","print('dl_cls_blend1', np.sqrt(mean_squared_error(train['price'],dl_cls_blend1)))\n","\n","ftt_reg_blend1 = 0.5*ftt_reg_clip_data['oof'] + 0.5*ftt_reg_clip_wodata['oof']\n","print('ftt_reg_blend1', np.sqrt(mean_squared_error(train['price'],ftt_reg_blend1)))\n","\n","ftt_cls_blend1 = 0.6*ftt_cls_clip_data['oof'] + 0.4*ftt_cls_clip_wodata['oof']\n","print('ftt_cls_blend1', np.sqrt(mean_squared_error(train['price'],ftt_cls_blend1)))\n","\n","\n","gbm_blend1 = 0.6*cb_blend1 + 0.4*lgb_blend1\n","print('gbm_blend1', np.sqrt(mean_squared_error(train['price'], gbm_blend1)))\n","\n","dl_blend1 = 0.4*dl_reg_blend1 + 0.6*dl_cls_blend1\n","print('dl_blend1', np.sqrt(mean_squared_error(train['price'], dl_blend1)))\n","\n","ftt_blend1 = 0.4*ftt_reg_blend1 + 0.6*ftt_cls_blend1\n","print('ftt_blend1', np.sqrt(mean_squared_error(train['price'], ftt_blend1)))\n","\n","all_blend1 = 0.4*gbm_blend1 + 0.45*dl_blend1 + 0.15*ftt_blend1\n","print('all_blend1', np.sqrt(mean_squared_error(train['price'], all_blend1)))\n","\n","print('============ no clip ===========')\n","\n","cb_blend = 0.7*cb_woclip_data['oof'] + 0.3*cb_woclip_wodata['oof']\n","print('cb_blend', np.sqrt(mean_squared_error(train['price'],cb_blend)))\n","\n","lgb_blend = 0.6*lgb_woclip_data['oof'] + 0.4*lgb_woclip_wodata['oof']\n","print('lgb_blend', np.sqrt(mean_squared_error(train['price'],lgb_blend)))\n","\n","dl_reg_blend = 0.5*dl_reg_woclip_data['oof'] + 0.5*dl_reg_woclip_wodata['oof']\n","print('dl_reg_blend', np.sqrt(mean_squared_error(train['price'],dl_reg_blend)))\n","\n","dl_cls_blend = 0.6*dl_cls_woclip_data['oof'] + 0.4*dl_cls_woclip_wodata['oof']\n","print('dl_cls_blend', np.sqrt(mean_squared_error(train['price'],dl_cls_blend)))\n","\n","ftt_reg_blend = 0.5*ftt_reg_woclip_data['oof'] + 0.5*ftt_reg_woclip_wodata['oof']\n","print('ftt_reg_blend', np.sqrt(mean_squared_error(train['price'],ftt_reg_blend)))\n","\n","ftt_cls_blend = 0.6*ftt_cls_woclip_data['oof'] + 0.4*ftt_cls_woclip_wodata['oof']\n","print('ftt_cls_blend', np.sqrt(mean_squared_error(train['price'],ftt_cls_blend)))\n","\n","\n","gbm_blend = 0.4*cb_blend1 + 0.4*lgb_blend + 0.2 * cb_blend\n","print('gbm_blend', np.sqrt(mean_squared_error(train['price'], gbm_blend)))\n","\n","dl_blend = 0.4*dl_reg_blend + 0.6*dl_cls_blend\n","print('dl_blend', np.sqrt(mean_squared_error(train['price'], dl_blend)))\n","\n","ftt_blend = 0.3*ftt_reg_blend + 0.7*ftt_cls_blend \n","print('ftt_blend', np.sqrt(mean_squared_error(train['price'], ftt_blend)))\n","\n","all_blend = 0.25*gbm_blend + 0.6*dl_blend + 0.15*ftt_blend\n","print('all_blend', np.sqrt(mean_squared_error(train['price'], all_blend)))\n","\n","print('============ final ===========')\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["cb_blend 72603.17802993162\n","lgb_blend 72577.56619206312\n","dl_reg_blend 72554.10550246558\n","dl_cls_blend 72493.64674517023\n","ftt_reg_blend 72826.89400857108\n","ftt_cls_blend 72562.48338206876\n","gbm_blend 72510.79114053813\n","dl_blend 72431.63394545649\n","ftt_blend 72487.94472391986\n","all_blend 72409.36716955696"]},{"cell_type":"code","execution_count":91,"metadata":{},"outputs":[{"data":{"text/plain":["['predict_72075_additional_test.jbl']"]},"execution_count":91,"metadata":{},"output_type":"execute_result"}],"source":["joblib.dump(all_blend, 'predict_72075_additional_test.jbl')"]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["train_stack = train2[['price']]\n","train_stack['cb_woclip_data']=cb_woclip_data['oof']\n","train_stack['cb_woclip_wodata']=cb_woclip_wodata['oof']\n","\n","train_stack['cb_clip_data']=cb_clip_data['oof']\n","train_stack['cb_clip_wodata']=cb_clip_wodata['oof']\n","\n","print('========')\n","\n","train_stack['lgb_woclip_data']=lgb_woclip_data['oof']\n","train_stack['lgb_woclip_wodata']=lgb_woclip_wodata['oof']\n","\n","train_stack['lgb_clip_data']=lgb_clip_data['oof']\n","train_stack['lgb_clip_wodata']=lgb_clip_wodata['oof']\n","\n","print('========')\n","\n","\n","train_stack['dl_cls_woclip_data']=dl_cls_woclip_data['oof']\n","train_stack['dl_cls_woclip_wodata']=dl_cls_woclip_wodata['oof']\n","train_stack['dl_reg_woclip_data']=dl_reg_woclip_data['oof']\n","train_stack['dl_reg_woclip_wodata']=dl_reg_woclip_wodata['oof']\n","\n","train_stack['dl_cls_clip_data']=dl_cls_clip_data['oof']\n","train_stack['dl_cls_clip_wodata']=dl_cls_clip_wodata['oof']\n","train_stack['dl_reg_clip_data']=dl_reg_clip_data['oof']\n","train_stack['dl_reg_clip_wodata']=dl_reg_clip_wodata['oof']\n","\n","print('========')\n","\n","\n","train_stack['ftt_cls_woclip_data']=ftt_cls_woclip_data['oof']\n","train_stack['ftt_cls_woclip_wodata']=ftt_cls_woclip_wodata['oof']\n","train_stack['ftt_reg_woclip_data']=ftt_reg_woclip_data['oof']\n","train_stack['ftt_reg_woclip_wodata']=ftt_reg_woclip_wodata['oof']\n","\n","train_stack['ftt_cls_clip_data']=ftt_cls_clip_data['oof']\n","train_stack['ftt_cls_clip_wodata']=ftt_cls_clip_wodata['oof']\n","train_stack['ftt_reg_clip_data']=ftt_reg_clip_data['oof']\n","train_stack['ftt_reg_clip_wodata']=ftt_reg_clip_wodata['oof']\n","\n","print('AAAAAAAA')\n","test_stack = test2[['id']]\n","test_stack['cb_woclip_data']=cb_woclip_data['pred']\n","test_stack['cb_woclip_wodata']=cb_woclip_wodata['pred']\n","\n","test_stack['cb_clip_data']=cb_clip_data['pred']\n","test_stack['cb_clip_wodata']=cb_clip_wodata['pred']\n","\n","print('========')\n","\n","test_stack['lgb_woclip_data']=lgb_woclip_data['pred']\n","test_stack['lgb_woclip_wodata']=lgb_woclip_wodata['pred']\n","\n","test_stack['lgb_clip_data']=lgb_clip_data['pred']\n","test_stack['lgb_clip_wodata']=lgb_clip_wodata['pred']\n","\n","print('========')\n","\n","\n","test_stack['dl_cls_woclip_data']=dl_cls_woclip_data['pred']\n","test_stack['dl_cls_woclip_wodata']=dl_cls_woclip_wodata['pred']\n","test_stack['dl_reg_woclip_data']=dl_reg_woclip_data['pred']\n","test_stack['dl_reg_woclip_wodata']=dl_reg_woclip_wodata['pred']\n","\n","test_stack['dl_cls_clip_data']=dl_cls_clip_data['pred']\n","test_stack['dl_cls_clip_wodata']=dl_cls_clip_wodata['pred']\n","test_stack['dl_reg_clip_data']=dl_reg_clip_data['pred']\n","test_stack['dl_reg_clip_wodata']=dl_reg_clip_wodata['pred']\n","\n","print('========')\n","\n","\n","test_stack['ftt_cls_woclip_data']=ftt_cls_woclip_data['pred']\n","test_stack['ftt_cls_woclip_wodata']=ftt_cls_woclip_wodata['pred']\n","test_stack['ftt_reg_woclip_data']=ftt_reg_woclip_data['pred']\n","test_stack['ftt_reg_woclip_wodata']=ftt_reg_woclip_wodata['pred']\n","\n","test_stack['ftt_cls_clip_data']=ftt_cls_clip_data['pred']\n","test_stack['ftt_cls_clip_wodata']=ftt_cls_clip_wodata['pred']\n","test_stack['ftt_reg_clip_data']=ftt_reg_clip_data['pred']\n","test_stack['ftt_reg_clip_wodata']=ftt_reg_clip_wodata['pred']\n","\n","print('========')\n","\n"]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":["from sklearn.metrics import log_loss\n","from sklearn.model_selection import KFold\n","task = Task('reg')\n","oof2 = np.zeros(len(train2))\n","pred = 0\n","models = {}\n","if True:\n"," for fold, (tr_idx, te_idx) in enumerate(KFold(n_splits=10, random_state=42, shuffle=True).split(train_stack['price'], train_stack['price'], None)):\n"," x_tr, x_vl = train_stack.iloc[tr_idx].reset_index(drop=True), train_stack.iloc[te_idx].reset_index(drop=True)\n"," #if add_data is not None:\n"," # x_tr = pd.concat([x_tr, train2_add], axis=0).reset_index(drop=True)\n"," \n"," #x_tr['price'] = np.clip(x_tr['price'], 0, 500_000)\n","\n"," scaler = RobustScaler()\n"," scaler.fit(x_tr['price'].values.reshape(-1, 1))\n"," x_tr['price'] = scaler.transform(x_tr['price'].values.reshape(-1, 1))\n"," x_vl['price'] = scaler.transform(x_vl['price'].values.reshape(-1, 1))\n","\n"," automl1 = TabularAutoML(debug=True,\n"," task = task, \n"," timeout = 600 * 3600,\n"," cpu_limit = 2, \n"," gpu_ids = '1',\n"," selection_params = {'mode': 0},\n"," general_params = {\"use_algos\": [['denselight']]}, \n"," nn_params = {\n"," \"n_epochs\": 10, \n"," \"bs\": 1024//2, \n"," \"num_workers\": 0, \n"," \"path_to_save\": None, \n"," \"freeze_defaults\": True,\n"," #\"cont_embedder\": 'plr',\n"," 'cat_embedder': 'weighted',\n"," 'act_fun': 'GELU',#'SiLU',\n"," \"hidden_size\": [64, 32], #32,\n"," 'stop_by_metric': True,\n"," 'embedding_size': 37,#32,\n"," 'verbose_bar': True,\n"," 'input_bn': False,\n"," 'opt_params': { 'lr': 0.0003 , 'weight_decay': 0 }\n"," },\n"," nn_pipeline_params = {\"use_qnt\": False, \"use_te\": False},\n"," reader_params = {'n_jobs': 5, 'cv': 10, 'random_state': 42, 'advanced_roles': False})\n","\n"," out_of_fold_predictions = automl1.fit_predict(\n"," x_tr, valid_data = x_vl, \n"," roles = {\n"," 'target': 'price',\n"," 'drop': ['id'],\n"," \n"," }, \n"," verbose = 1)\n"," oof2[te_idx] = scaler.inverse_transform(out_of_fold_predictions.data.flatten().reshape(-1, 1)).flatten()\n"," #oof[te_idx] = out_of_fold_predictions.data.flatten().reshape(-1, 1).flatten()\n","\n"," pred += scaler.inverse_transform(automl1.predict(test_stack).data.flatten().reshape(-1, 1)).flatten() / 10\n"," #pred_add += (automl1.predict(test2_add).data @ values.reshape(-1, 1)).flatten() / 10\n","\n"," models[fold] = automl1\n"," #res_dl_cls = {'oof': oof, 'pred': pred, 'pred_add': pred_add, 'models': models}\n"," #joblib.dump(res_dl_cls, f'denselight_cls_{clip_name}_{data_name}.jbl')\n"," print(f'oof', np.sqrt(mean_squared_error(train2['price'], oof2)))"]},{"cell_type":"code","execution_count":176,"metadata":{},"outputs":[{"data":{"text/plain":["['stack_denselight_reg.jbl']"]},"execution_count":176,"metadata":{},"output_type":"execute_result"}],"source":["res_dl_cls = {'oof': oof2, 'pred': pred, 'models': models}\n","joblib.dump(res_dl_cls, f'stack_denselight_reg.jbl')"]},{"cell_type":"code","execution_count":187,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["============ clip ===========\n","cb_blend1 72562.41639936849\n","lgb_blend1 72577.25042227953\n","dl_reg_blend1 72570.4577558202\n","dl_cls_blend1 72576.6460432608\n","ftt_reg_blend1 72630.82437226783\n","ftt_cls_blend1 72590.73705499641\n","gbm_blend1 72537.53694244122\n","dl_blend1 72525.34974947025\n","ftt_blend1 72535.56219749196\n","all_blend1 72482.96183545176\n","============ no clip ===========\n","cb_blend 72603.17802993162\n","lgb_blend 72577.56619206312\n","dl_reg_blend 72554.10550246558\n","dl_cls_blend 72493.64674517023\n","ftt_reg_blend 72826.89400857108\n","ftt_cls_blend 72562.48338206876\n","gbm_blend 72510.79114053813\n","dl_blend 72431.63394545649\n","ftt_blend 72487.94472391986\n","all_blend 72409.36716955696\n","============ final ===========\n","final 72401.66637463638\n"]}],"source":["print('============ clip ===========')\n","\n","\n","cb_blend1 = 0.7*cb_clip_data['oof'] + 0.3*cb_clip_wodata['oof']\n","print('cb_blend1', np.sqrt(mean_squared_error(train['price'],cb_blend1)))\n","\n","lgb_blend1 = 0.5*lgb_clip_data['oof'] + 0.5*lgb_clip_wodata['oof']\n","print('lgb_blend1', np.sqrt(mean_squared_error(train['price'],lgb_blend1)))\n","\n","dl_reg_blend1 = 0.4*dl_reg_clip_data['oof'] + 0.6*dl_reg_clip_wodata['oof']\n","print('dl_reg_blend1', np.sqrt(mean_squared_error(train['price'],dl_reg_blend1)))\n","\n","dl_cls_blend1 = 0.6*dl_cls_clip_data['oof'] + 0.4*dl_cls_clip_wodata['oof']\n","print('dl_cls_blend1', np.sqrt(mean_squared_error(train['price'],dl_cls_blend1)))\n","\n","ftt_reg_blend1 = 0.5*ftt_reg_clip_data['oof'] + 0.5*ftt_reg_clip_wodata['oof']\n","print('ftt_reg_blend1', np.sqrt(mean_squared_error(train['price'],ftt_reg_blend1)))\n","\n","ftt_cls_blend1 = 0.6*ftt_cls_clip_data['oof'] + 0.4*ftt_cls_clip_wodata['oof']\n","print('ftt_cls_blend1', np.sqrt(mean_squared_error(train['price'],ftt_cls_blend1)))\n","\n","\n","gbm_blend1 = 0.6*cb_blend1 + 0.4*lgb_blend1\n","print('gbm_blend1', np.sqrt(mean_squared_error(train['price'], gbm_blend1)))\n","\n","dl_blend1 = 0.4*dl_reg_blend1 + 0.6*dl_cls_blend1\n","print('dl_blend1', np.sqrt(mean_squared_error(train['price'], dl_blend1)))\n","\n","ftt_blend1 = 0.4*ftt_reg_blend1 + 0.6*ftt_cls_blend1\n","print('ftt_blend1', np.sqrt(mean_squared_error(train['price'], ftt_blend1)))\n","\n","all_blend1 = 0.4*gbm_blend1 + 0.45*dl_blend1 + 0.15*ftt_blend1\n","print('all_blend1', np.sqrt(mean_squared_error(train['price'], all_blend1)))\n","\n","print('============ no clip ===========')\n","\n","cb_blend = 0.7*cb_woclip_data['oof'] + 0.3*cb_woclip_wodata['oof']\n","print('cb_blend', np.sqrt(mean_squared_error(train['price'],cb_blend)))\n","\n","lgb_blend = 0.6*lgb_woclip_data['oof'] + 0.4*lgb_woclip_wodata['oof']\n","print('lgb_blend', np.sqrt(mean_squared_error(train['price'],lgb_blend)))\n","\n","dl_reg_blend = 0.5*dl_reg_woclip_data['oof'] + 0.5*dl_reg_woclip_wodata['oof']\n","print('dl_reg_blend', np.sqrt(mean_squared_error(train['price'],dl_reg_blend)))\n","\n","dl_cls_blend = 0.6*dl_cls_woclip_data['oof'] + 0.4*dl_cls_woclip_wodata['oof']\n","print('dl_cls_blend', np.sqrt(mean_squared_error(train['price'],dl_cls_blend)))\n","\n","ftt_reg_blend = 0.5*ftt_reg_woclip_data['oof'] + 0.5*ftt_reg_woclip_wodata['oof']\n","print('ftt_reg_blend', np.sqrt(mean_squared_error(train['price'],ftt_reg_blend)))\n","\n","ftt_cls_blend = 0.6*ftt_cls_woclip_data['oof'] + 0.4*ftt_cls_woclip_wodata['oof']\n","print('ftt_cls_blend', np.sqrt(mean_squared_error(train['price'],ftt_cls_blend)))\n","\n","\n","gbm_blend = 0.4*cb_blend1 + 0.4*lgb_blend + 0.2 * cb_blend\n","print('gbm_blend', np.sqrt(mean_squared_error(train['price'], gbm_blend)))\n","\n","dl_blend = 0.4*dl_reg_blend + 0.6*dl_cls_blend\n","print('dl_blend', np.sqrt(mean_squared_error(train['price'], dl_blend)))\n","\n","ftt_blend = 0.3*ftt_reg_blend + 0.7*ftt_cls_blend \n","print('ftt_blend', np.sqrt(mean_squared_error(train['price'], ftt_blend)))\n","\n","all_blend = 0.25*gbm_blend + 0.6*dl_blend + 0.15*ftt_blend\n","print('all_blend', np.sqrt(mean_squared_error(train['price'], all_blend)))\n","\n","print('============ final ===========')\n","final = 0.3*all_blend + 0.7*oof2\n","print('final', np.sqrt(mean_squared_error(train['price'], final)))\n"]},{"cell_type":"code","execution_count":179,"metadata":{},"outputs":[{"data":{"text/html":["
\n","\n","\n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n","
idprice
018853316742.635747
118853476980.605503
218853556976.457638
318853627917.946792
418853730369.074393
.........
12568531421828626.706770
12568631421950338.587243
12568731422019337.972836
12568831422115089.566045
12568931422238719.391296
\n","

125690 rows × 2 columns

\n","
"],"text/plain":[" id price\n","0 188533 16742.635747\n","1 188534 76980.605503\n","2 188535 56976.457638\n","3 188536 27917.946792\n","4 188537 30369.074393\n","... ... ...\n","125685 314218 28626.706770\n","125686 314219 50338.587243\n","125687 314220 19337.972836\n","125688 314221 15089.566045\n","125689 314222 38719.391296\n","\n","[125690 rows x 2 columns]"]},"execution_count":179,"metadata":{},"output_type":"execute_result"}],"source":["cb_blend1 = 0.7*cb_clip_data['pred'] + 0.3*cb_clip_wodata['pred']\n","\n","cb_blend = 0.7*cb_woclip_data['pred'] + 0.3*cb_woclip_wodata['pred']\n","\n","lgb_blend = 0.6*lgb_woclip_data['pred'] + 0.4*lgb_woclip_wodata['pred']\n","\n","dl_reg_blend = 0.5*dl_reg_woclip_data['pred'] + 0.5*dl_reg_woclip_wodata['pred']\n","\n","dl_cls_blend = 0.6*dl_cls_woclip_data['pred'] + 0.4*dl_cls_woclip_wodata['pred']\n","\n","ftt_reg_blend = 0.5*ftt_reg_woclip_data['pred'] + 0.5*ftt_reg_woclip_wodata['pred']\n","\n","ftt_cls_blend = 0.6*ftt_cls_woclip_data['pred'] + 0.4*ftt_cls_woclip_wodata['pred']\n","\n","\n","gbm_blend = 0.4*cb_blend1 + 0.4*lgb_blend + 0.2 * cb_blend\n","\n","dl_blend = 0.4*dl_reg_blend + 0.6*dl_cls_blend\n","\n","ftt_blend = 0.3*ftt_reg_blend + 0.7*ftt_cls_blend\n","\n","all_blend = 0.25*gbm_blend + 0.6*dl_blend + 0.15*ftt_blend\n","\n","ss = pd.read_csv('./data/sample_submission.csv')\n","#ss['price'] = 0.3*all_blend + 0.7*pred\n","#ss.to_csv('lama_stack_blend_72401_66.csv', index=False)\n","\n","ss['price'] = 0.8*all_blend + 0.2*pred\n","ss.to_csv('lama_stack_blend2_weightbylb_02_08.csv', index=False)\n","ss\n"]},{"cell_type":"code","execution_count":180,"metadata":{},"outputs":[{"data":{"text/plain":[""]},"execution_count":180,"metadata":{},"output_type":"execute_result"},{"data":{"image/png":"iVBORw0KGgoAAAANSUhEUgAAAiMAAAG+CAYAAABBOgSxAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAjP0lEQVR4nO3de3BU9R338c8Sko0UAiJCCIR7ucglBBQM1hJaIFCGNtMpVbSSUbC1hQ40VRpqR0hRo0+5ORVFh0KKHQTBIU4FkRgMDIJ1uGQACwjIQywkAUQSEuyyZs/zh0/WRpKQkwtfsnm/ZjLtnj1nz2+/7Kzv2d1sPI7jOAIAADDSwnoBAACgeSNGAACAKWIEAACYIkYAAIApYgQAAJgiRgAAgCliBAAAmCJGAACAKWIEAACYIkYAAICpJhUjO3fu1OTJkxUTEyOPx6OsrKxGPd+CBQvk8Xgq/fTv379RzwkAQHPTpGKkrKxMcXFxWr58+Q0758CBA1VQUBD82bVr1w07NwAAzUFL6wW4MXHiRE2cOLHa630+n5588km9/vrrunTpkgYNGqTnn39eiYmJdT5ny5YtFR0dXefjAQBAzZrUKyPXM2vWLO3Zs0fr1q3TwYMHNWXKFE2YMEHHjx+v820eP35cMTEx6tWrlx588EHl5+c34IoBAIDHcRzHehF14fF4tGnTJiUnJ0uS8vPz1atXL+Xn5ysmJia439ixYzVixAg9++yzrs/xzjvvqLS0VP369VNBQYHS09N15swZHT58WG3atGmouwIAQLPWpN6mqcmhQ4dUXl6uvn37Vtru8/l02223SZKOHj2qAQMG1Hg7f/jDH/Tcc89JUqW3hIYMGaKRI0eqe/fueuONNzR9+vQGvgcAADRPIRMjpaWlCgsL0759+xQWFlbputatW0uSevXqpSNHjtR4OxXhUpV27dqpb9++OnHiRP0XDAAAJIVQjMTHx6u8vFznzp3T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ta70OYgQAAJjiV3sBAIApYgQAAJgiRgAAgCliBAAAmCJGAACAKWIEAACYIkYAAIApYgQAAJgiRgAAgCliBAAAmCJGAACAqf8HlUA7pQm/1ccAAAAASUVORK5CYII=","text/plain":["
"]},"metadata":{},"output_type":"display_data"}],"source":["ss['price'].hist(bins=100, density=True)\n","train['price'].hist(bins=100, alpha=0.5, density=True)"]}],"metadata":{"kaggle":{"accelerator":"gpu","dataSources":[{"databundleVersionId":8930475,"sourceId":73291,"sourceType":"competition"}],"dockerImageVersionId":30733,"isGpuEnabled":true,"isInternetEnabled":true,"language":"python","sourceType":"notebook"},"kernelspec":{"display_name":"icecube_jup","language":"python","name":"icecube"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.8.16"}},"nbformat":4,"nbformat_minor":4} 2 | --------------------------------------------------------------------------------