{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nimport warnings\nimport numpy as np\nimport random\nfrom scipy.stats import zscore\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.preprocessing import LabelEncoder\nfrom sklearn.metrics import mean_squared_error\n\nfrom xgboost import XGBRegressor\nfrom sklearn.ensemble import AdaBoostRegressor\nfrom catboost import CatBoostRegressor\nfrom lightgbm import LGBMRegressor\nwarnings.filterwarnings(\"ignore\")\nfrom pandas_profiling import ProfileReport\nplt.ion()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:13.287065Z","iopub.status.busy":"2021-08-26T22:05:13.286390Z","iopub.status.idle":"2021-08-26T22:05:16.530714Z","shell.execute_reply":"2021-08-26T22:05:16.531182Z","shell.execute_reply.started":"2021-08-26T21:55:51.986474Z"},"papermill":{"duration":3.310158,"end_time":"2021-08-26T22:05:16.531383","exception":false,"start_time":"2021-08-26T22:05:13.221225","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def set_seed(seed=42):\n    random.seed(seed)\n    np.random.seed(seed)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:16.654266Z","iopub.status.busy":"2021-08-26T22:05:16.653241Z","iopub.status.idle":"2021-08-26T22:05:16.655621Z","shell.execute_reply":"2021-08-26T22:05:16.656190Z","shell.execute_reply.started":"2021-08-26T20:35:18.932466Z"},"papermill":{"duration":0.065508,"end_time":"2021-08-26T22:05:16.656354","exception":false,"start_time":"2021-08-26T22:05:16.590846","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"set_seed()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:16.779424Z","iopub.status.busy":"2021-08-26T22:05:16.778454Z","iopub.status.idle":"2021-08-26T22:05:16.783628Z","shell.execute_reply":"2021-08-26T22:05:16.784113Z","shell.execute_reply.started":"2021-08-26T20:35:21.310418Z"},"papermill":{"duration":0.068442,"end_time":"2021-08-26T22:05:16.784292","exception":false,"start_time":"2021-08-26T22:05:16.715850","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df=pd.read_csv(\"../input/beyond-analysis/train.csv\")\ndf","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:16.909814Z","iopub.status.busy":"2021-08-26T22:05:16.908880Z","iopub.status.idle":"2021-08-26T22:05:23.848652Z","shell.execute_reply":"2021-08-26T22:05:23.849121Z","shell.execute_reply.started":"2021-08-26T20:35:21.551118Z"},"papermill":{"duration":7.005038,"end_time":"2021-08-26T22:05:23.849326","exception":false,"start_time":"2021-08-26T22:05:16.844288","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.describe()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:24.057916Z","iopub.status.busy":"2021-08-26T22:05:23.975724Z","iopub.status.idle":"2021-08-26T22:05:24.959508Z","shell.execute_reply":"2021-08-26T22:05:24.958937Z","shell.execute_reply.started":"2021-08-26T19:47:54.053380Z"},"papermill":{"duration":1.049389,"end_time":"2021-08-26T22:05:24.959672","exception":false,"start_time":"2021-08-26T22:05:23.910283","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.info()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:25.087663Z","iopub.status.busy":"2021-08-26T22:05:25.086928Z","iopub.status.idle":"2021-08-26T22:05:25.421090Z","shell.execute_reply":"2021-08-26T22:05:25.420410Z","shell.execute_reply.started":"2021-08-26T19:47:54.911254Z"},"papermill":{"duration":0.399709,"end_time":"2021-08-26T22:05:25.421249","exception":false,"start_time":"2021-08-26T22:05:25.021540","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.distplot(x=df[\"Y1\"])","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:25.567891Z","iopub.status.busy":"2021-08-26T22:05:25.564167Z","iopub.status.idle":"2021-08-26T22:05:30.642062Z","shell.execute_reply":"2021-08-26T22:05:30.640832Z","shell.execute_reply.started":"2021-08-26T19:47:55.232267Z"},"papermill":{"duration":5.158473,"end_time":"2021-08-26T22:05:30.642246","exception":false,"start_time":"2021-08-26T22:05:25.483773","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"profile = ProfileReport(df, title=\"Pandas Profiling Report\")\nprofile","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.distplot(x=df[\"Y2\"])","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:30.799283Z","iopub.status.busy":"2021-08-26T22:05:30.798642Z","iopub.status.idle":"2021-08-26T22:05:37.226294Z","shell.execute_reply":"2021-08-26T22:05:37.225688Z","shell.execute_reply.started":"2021-08-26T19:48:00.027348Z"},"papermill":{"duration":6.519921,"end_time":"2021-08-26T22:05:37.226468","exception":false,"start_time":"2021-08-26T22:05:30.706547","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(x=\"STATUS_CHECK\", data=df)\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:37.366610Z","iopub.status.busy":"2021-08-26T22:05:37.365866Z","iopub.status.idle":"2021-08-26T22:05:37.648509Z","shell.execute_reply":"2021-08-26T22:05:37.648990Z","shell.execute_reply.started":"2021-08-26T19:48:06.254525Z"},"papermill":{"duration":0.358371,"end_time":"2021-08-26T22:05:37.649267","exception":false,"start_time":"2021-08-26T22:05:37.290896","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(x=\"CATEGORY_1\", data=df)\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:37.902035Z","iopub.status.busy":"2021-08-26T22:05:37.901057Z","iopub.status.idle":"2021-08-26T22:05:39.407047Z","shell.execute_reply":"2021-08-26T22:05:39.407996Z","shell.execute_reply.started":"2021-08-26T19:48:06.458469Z"},"papermill":{"duration":1.695181,"end_time":"2021-08-26T22:05:39.408243","exception":false,"start_time":"2021-08-26T22:05:37.713062","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(x=\"CATEGORY_2\", data=df)\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:39.544030Z","iopub.status.busy":"2021-08-26T22:05:39.542951Z","iopub.status.idle":"2021-08-26T22:05:41.115682Z","shell.execute_reply":"2021-08-26T22:05:41.116167Z","shell.execute_reply.started":"2021-08-26T19:48:08.082192Z"},"papermill":{"duration":1.640599,"end_time":"2021-08-26T22:05:41.116391","exception":false,"start_time":"2021-08-26T22:05:39.475792","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(x=\"ACTIVE_YN\", data=df)\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:41.257908Z","iopub.status.busy":"2021-08-26T22:05:41.256883Z","iopub.status.idle":"2021-08-26T22:05:41.458201Z","shell.execute_reply":"2021-08-26T22:05:41.458691Z","shell.execute_reply.started":"2021-08-26T19:48:09.579733Z"},"papermill":{"duration":0.274965,"end_time":"2021-08-26T22:05:41.458873","exception":false,"start_time":"2021-08-26T22:05:41.183908","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df[\"DEPOSIT_TRAILS\"].nunique()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:41.593496Z","iopub.status.busy":"2021-08-26T22:05:41.592536Z","iopub.status.idle":"2021-08-26T22:05:41.617043Z","shell.execute_reply":"2021-08-26T22:05:41.617555Z","shell.execute_reply.started":"2021-08-26T19:48:09.772770Z"},"papermill":{"duration":0.093051,"end_time":"2021-08-26T22:05:41.617746","exception":false,"start_time":"2021-08-26T22:05:41.524695","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams['figure.figsize'] = [14,7]\nfig,ax=plt.subplots(1,2)\nax[0].set_title(\"DEPOSIT_TRAILS\")\nsns.distplot(x=df[\"DEPOSIT_TRAILS\"],ax=ax[0])\nax[1].set_title(\"DEPOSIT_TRAILS Transformed\")\nsns.distplot(x=np.log(1+np.power(df[\"DEPOSIT_TRAILS\"],0.25)), ax=ax[1])\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:41.755166Z","iopub.status.busy":"2021-08-26T22:05:41.754218Z","iopub.status.idle":"2021-08-26T22:05:52.194086Z","shell.execute_reply":"2021-08-26T22:05:52.193566Z","shell.execute_reply.started":"2021-08-26T19:48:09.796750Z"},"papermill":{"duration":10.508762,"end_time":"2021-08-26T22:05:52.194233","exception":false,"start_time":"2021-08-26T22:05:41.685471","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams['figure.figsize'] = [14,7]\nfig,ax=plt.subplots(1,2)\nax[0].set_title(\"REVENUE\")\nsns.distplot(x=df[\"REVENUE\"],ax=ax[0])\nax[1].set_title(\"REVENUE Transformed\")\nsns.distplot(x=np.log(1+np.power(df[\"REVENUE\"],0.25)), ax=ax[1])\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:05:52.386039Z","iopub.status.busy":"2021-08-26T22:05:52.381840Z","iopub.status.idle":"2021-08-26T22:06:03.568713Z","shell.execute_reply":"2021-08-26T22:06:03.568056Z","shell.execute_reply.started":"2021-08-26T19:48:20.124656Z"},"papermill":{"duration":11.307118,"end_time":"2021-08-26T22:06:03.568857","exception":false,"start_time":"2021-08-26T22:05:52.261739","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams['figure.figsize'] = [14,7]\nfig,ax=plt.subplots(1,2)\nax[0].set_title(\"WINNINGS_1\")\nsns.distplot(x=df[\"WINNINGS_1\"],ax=ax[0])\nax[1].set_title(\"WINNINGS_1 Transformed\")\nsns.distplot(x=np.log(1+np.power(df[\"WINNINGS_1\"],0.25)), ax=ax[1])\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:06:03.736130Z","iopub.status.busy":"2021-08-26T22:06:03.729099Z","iopub.status.idle":"2021-08-26T22:06:14.777305Z","shell.execute_reply":"2021-08-26T22:06:14.776679Z","shell.execute_reply.started":"2021-08-26T19:48:31.199249Z"},"papermill":{"duration":11.141876,"end_time":"2021-08-26T22:06:14.777477","exception":false,"start_time":"2021-08-26T22:06:03.635601","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams['figure.figsize'] = [14,7]\nfig,ax=plt.subplots(1,2)\nax[0].set_title(\"WINNINGS_2\")\nsns.distplot(x=df[\"WINNINGS_2\"],ax=ax[0])\nax[1].set_title(\"WINNINGS_2 Transformed\")\nsns.distplot(x=np.log(1+np.power(df[\"WINNINGS_2\"],0.25)), ax=ax[1])\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:06:14.941323Z","iopub.status.busy":"2021-08-26T22:06:14.938788Z","iopub.status.idle":"2021-08-26T22:06:25.117096Z","shell.execute_reply":"2021-08-26T22:06:25.116278Z","shell.execute_reply.started":"2021-08-26T19:48:42.093146Z"},"papermill":{"duration":10.270582,"end_time":"2021-08-26T22:06:25.117248","exception":false,"start_time":"2021-08-26T22:06:14.846666","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams['figure.figsize'] = [14,7]\nfig,ax=plt.subplots(1,2)\nax[0].set_title(\"DISCOUNT\")\nsns.distplot(x=df[\"DISCOUNT\"],ax=ax[0])\nax[1].set_title(\"DISCOUNT Transformed\")\nsns.distplot(x=np.log(1+np.power(df[\"DISCOUNT\"],0.1)), ax=ax[1])\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:06:25.295702Z","iopub.status.busy":"2021-08-26T22:06:25.294668Z","iopub.status.idle":"2021-08-26T22:06:36.479285Z","shell.execute_reply":"2021-08-26T22:06:36.479869Z","shell.execute_reply.started":"2021-08-26T19:48:52.232743Z"},"papermill":{"duration":11.29257,"end_time":"2021-08-26T22:06:36.480091","exception":false,"start_time":"2021-08-26T22:06:25.187521","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams['figure.figsize'] = [14,7]\nfig,ax=plt.subplots(1,2)\nax[0].set_title(\"DEPOSIT\")\nsns.distplot(x=df[\"DEPOSIT\"],ax=ax[0])\nax[1].set_title(\"DEPOSIT Transformed\")\nsns.distplot(x=np.log(1+np.power(df[\"DEPOSIT\"],0.25)), ax=ax[1])\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:06:36.636455Z","iopub.status.busy":"2021-08-26T22:06:36.635187Z","iopub.status.idle":"2021-08-26T22:06:47.782854Z","shell.execute_reply":"2021-08-26T22:06:47.782152Z","shell.execute_reply.started":"2021-08-26T19:49:03.577525Z"},"papermill":{"duration":11.229365,"end_time":"2021-08-26T22:06:47.783025","exception":false,"start_time":"2021-08-26T22:06:36.553660","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams['figure.figsize'] = [14,7]\nfig,ax=plt.subplots(1,2)\nax[0].set_title(\"WITHDRAW\")\nsns.distplot(x=df[\"WITHDRAW\"],ax=ax[0])\nax[1].set_title(\"WITHDRAW Transformed\")\nsns.distplot(x=np.log(1+np.power(df[\"WITHDRAW\"],0.25)), ax=ax[1])\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:06:47.980327Z","iopub.status.busy":"2021-08-26T22:06:47.952084Z","iopub.status.idle":"2021-08-26T22:06:57.865332Z","shell.execute_reply":"2021-08-26T22:06:57.864791Z","shell.execute_reply.started":"2021-08-26T19:49:14.486870Z"},"papermill":{"duration":10.009032,"end_time":"2021-08-26T22:06:57.865500","exception":false,"start_time":"2021-08-26T22:06:47.856468","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams['figure.figsize'] = [14,7]\nfig,ax=plt.subplots(1,2)\nax[0].set_title(\"ENTRY_NUMBER\")\nsns.distplot(x=df[\"ENTRY_NUMBER\"],ax=ax[0])\nax[1].set_title(\"ENTRY_NUMBER Transformed\")\nsns.distplot(x=np.log(1+np.power(df[\"ENTRY_NUMBER\"],0.25)), ax=ax[1])\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:06:58.035934Z","iopub.status.busy":"2021-08-26T22:06:58.026634Z","iopub.status.idle":"2021-08-26T22:07:10.046219Z","shell.execute_reply":"2021-08-26T22:07:10.047287Z","shell.execute_reply.started":"2021-08-26T19:49:24.373677Z"},"papermill":{"duration":12.108856,"end_time":"2021-08-26T22:07:10.047602","exception":false,"start_time":"2021-08-26T22:06:57.938746","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams['figure.figsize'] = [14,7]\nfig,ax=plt.subplots(1,2)\nax[0].set_title(\"WINNINGS_NUMBER\")\nsns.distplot(x=df[\"WINNINGS_NUMBER\"],ax=ax[0])\nax[1].set_title(\"WINNINGS_NUMBER Transformed\")\nsns.distplot(x=np.log(1+np.power(df[\"WINNINGS_NUMBER\"],0.25)), ax=ax[1])\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:07:10.247584Z","iopub.status.busy":"2021-08-26T22:07:10.245721Z","iopub.status.idle":"2021-08-26T22:07:21.951241Z","shell.execute_reply":"2021-08-26T22:07:21.950701Z","shell.execute_reply.started":"2021-08-26T19:49:36.025320Z"},"papermill":{"duration":11.819014,"end_time":"2021-08-26T22:07:21.951402","exception":false,"start_time":"2021-08-26T22:07:10.132388","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams['figure.figsize'] = [14,7]\nfig,ax=plt.subplots(1,2)\nax[0].set_title(\"PRACTICE_ENTRY\")\nsns.distplot(x=df[\"PRACTICE_ENTRY\"],ax=ax[0])\nax[1].set_title(\"PRACTICE_ENTRY Transformed\")\nsns.distplot(x=np.log(1+np.power(df[\"PRACTICE_ENTRY\"],0.25)), ax=ax[1])\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:07:22.122262Z","iopub.status.busy":"2021-08-26T22:07:22.120196Z","iopub.status.idle":"2021-08-26T22:07:32.237841Z","shell.execute_reply":"2021-08-26T22:07:32.237127Z","shell.execute_reply.started":"2021-08-26T19:49:47.390823Z"},"papermill":{"duration":10.208571,"end_time":"2021-08-26T22:07:32.237989","exception":false,"start_time":"2021-08-26T22:07:22.029418","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams['figure.figsize'] = [14,7]\nfig,ax=plt.subplots(1,2)\nax[0].set_title(\"PRACTICE_WINNINGS\")\nsns.distplot(x=df[\"PRACTICE_WINNINGS\"],ax=ax[0])\nax[1].set_title(\"PRACTICE_WINNINGS Transformed\")\nsns.distplot(x=np.log(1+np.power(df[\"PRACTICE_WINNINGS\"],0.25)), ax=ax[1])\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:07:32.404797Z","iopub.status.busy":"2021-08-26T22:07:32.404127Z","iopub.status.idle":"2021-08-26T22:07:42.466106Z","shell.execute_reply":"2021-08-26T22:07:42.465544Z","shell.execute_reply.started":"2021-08-26T19:49:57.498585Z"},"papermill":{"duration":10.152408,"end_time":"2021-08-26T22:07:42.466276","exception":false,"start_time":"2021-08-26T22:07:32.313868","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams['figure.figsize'] = [14,7]\nfig,ax=plt.subplots(1,2)\nax[0].set_title(\"PRACTICE_ENTRY_NUMBER\")\nsns.distplot(x=df[\"PRACTICE_ENTRY_NUMBER\"],ax=ax[0])\nax[1].set_title(\"PRACTICE_ENTRY_NUMBER Transformed\")\nsns.distplot(x=np.log(1+np.power(df[\"PRACTICE_ENTRY_NUMBER\"],0.25)), ax=ax[1])\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:07:42.647254Z","iopub.status.busy":"2021-08-26T22:07:42.644464Z","iopub.status.idle":"2021-08-26T22:07:52.854049Z","shell.execute_reply":"2021-08-26T22:07:52.853420Z","shell.execute_reply.started":"2021-08-26T19:50:07.675656Z"},"papermill":{"duration":10.309616,"end_time":"2021-08-26T22:07:52.854198","exception":false,"start_time":"2021-08-26T22:07:42.544582","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams['figure.figsize'] = [14,7]\nfig,ax=plt.subplots(1,2)\nax[0].set_title(\"PRACTICE_WINNINGS_NUMBER\")\nsns.distplot(x=df[\"PRACTICE_WINNINGS_NUMBER\"],ax=ax[0])\nax[1].set_title(\"PRACTICE_WINNINGS_NUMBER Transformed\")\nsns.distplot(x=np.log(1+np.power(df[\"PRACTICE_WINNINGS_NUMBER\"],0.25)), ax=ax[1])\nplt.show()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:07:53.039795Z","iopub.status.busy":"2021-08-26T22:07:53.039060Z","iopub.status.idle":"2021-08-26T22:08:05.618856Z","shell.execute_reply":"2021-08-26T22:08:05.618293Z","shell.execute_reply.started":"2021-08-26T19:50:17.668743Z"},"papermill":{"duration":12.687366,"end_time":"2021-08-26T22:08:05.619011","exception":false,"start_time":"2021-08-26T22:07:52.931645","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.jointplot(data=df, y=\"REVENUE\", x=\"Y1\")","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:08:05.781765Z","iopub.status.busy":"2021-08-26T22:08:05.780782Z","iopub.status.idle":"2021-08-26T22:11:21.423656Z","shell.execute_reply":"2021-08-26T22:11:21.424153Z","shell.execute_reply.started":"2021-08-26T19:50:30.162987Z"},"papermill":{"duration":195.72519,"end_time":"2021-08-26T22:11:21.424355","exception":false,"start_time":"2021-08-26T22:08:05.699165","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.jointplot(data=df, y=\"REVENUE\", x=\"Y2\")","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"categorical_variables=[\"STATUS_CHECK\", \"CATEGORY_1\", \"CATEGORY_2\", \"ACTIVE_YN\"]","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:21.593042Z","iopub.status.busy":"2021-08-26T22:11:21.592338Z","iopub.status.idle":"2021-08-26T22:11:21.595612Z","shell.execute_reply":"2021-08-26T22:11:21.594985Z","shell.execute_reply.started":"2021-08-26T19:53:41.600408Z"},"papermill":{"duration":0.089677,"end_time":"2021-08-26T22:11:21.595749","exception":false,"start_time":"2021-08-26T22:11:21.506072","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"le_cat1=LabelEncoder()\nle_cat1.fit(df[\"CATEGORY_1\"])","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:52.201045Z","iopub.status.busy":"2021-08-26T22:11:52.200355Z","iopub.status.idle":"2021-08-26T22:11:52.207092Z","shell.execute_reply":"2021-08-26T22:11:52.207598Z","shell.execute_reply.started":"2021-08-26T20:35:44.001411Z"},"papermill":{"duration":0.138166,"end_time":"2021-08-26T22:11:52.207765","exception":false,"start_time":"2021-08-26T22:11:52.069599","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"le_cat2=LabelEncoder()\nle_cat2.fit(df[\"CATEGORY_2\"])","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:52.393833Z","iopub.status.busy":"2021-08-26T22:11:52.393179Z","iopub.status.idle":"2021-08-26T22:11:52.442392Z","shell.execute_reply":"2021-08-26T22:11:52.441755Z","shell.execute_reply.started":"2021-08-26T20:35:44.191586Z"},"papermill":{"duration":0.14857,"end_time":"2021-08-26T22:11:52.442534","exception":false,"start_time":"2021-08-26T22:11:52.293964","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"continuous_variables=[\"REVENUE\", \"WINNINGS_1\", \"DEPOSIT_2\", \"DISCOUNT\", \"DEPOSIT\", \"WITHDRAW\", \"ENTRY_NUMBER\", \"ENTRY_NUMBER\", \"WINNINGS_NUMBER\"]","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:52.626917Z","iopub.status.busy":"2021-08-26T22:11:52.626179Z","iopub.status.idle":"2021-08-26T22:11:52.628552Z","shell.execute_reply":"2021-08-26T22:11:52.629012Z","shell.execute_reply.started":"2021-08-26T20:35:44.392689Z"},"papermill":{"duration":0.098591,"end_time":"2021-08-26T22:11:52.629205","exception":false,"start_time":"2021-08-26T22:11:52.530614","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df[\"CATEGORY_1\"]=le_cat1.transform(df[\"CATEGORY_1\"])\ndf[\"CATEGORY_2\"]=le_cat2.transform(df[\"CATEGORY_2\"])","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:52.839333Z","iopub.status.busy":"2021-08-26T22:11:52.834219Z","iopub.status.idle":"2021-08-26T22:11:53.522828Z","shell.execute_reply":"2021-08-26T22:11:53.522228Z","shell.execute_reply.started":"2021-08-26T20:35:44.571885Z"},"papermill":{"duration":0.806081,"end_time":"2021-08-26T22:11:53.522988","exception":false,"start_time":"2021-08-26T22:11:52.716907","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df=df.groupby([\"UNIQUE_IDENTIFIER\"]).mean().reset_index(drop=True)\ndf","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:53.706093Z","iopub.status.busy":"2021-08-26T22:11:53.704432Z","iopub.status.idle":"2021-08-26T22:11:54.167979Z","shell.execute_reply":"2021-08-26T22:11:54.167327Z","shell.execute_reply.started":"2021-08-26T20:35:45.274484Z"},"papermill":{"duration":0.557899,"end_time":"2021-08-26T22:11:54.168140","exception":false,"start_time":"2021-08-26T22:11:53.610241","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"num_bins = int(np.floor(1 + np.log2(len(df)))) \ndf.loc[:, \"bins\"] = pd.cut(df[\"Y2\"], bins=num_bins, labels=False)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:54.350403Z","iopub.status.busy":"2021-08-26T22:11:54.349436Z","iopub.status.idle":"2021-08-26T22:11:54.359325Z","shell.execute_reply":"2021-08-26T22:11:54.358781Z","shell.execute_reply.started":"2021-08-26T20:35:47.980077Z"},"papermill":{"duration":0.103679,"end_time":"2021-08-26T22:11:54.359495","exception":false,"start_time":"2021-08-26T22:11:54.255816","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans_df=df","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:54.539780Z","iopub.status.busy":"2021-08-26T22:11:54.538986Z","iopub.status.idle":"2021-08-26T22:11:54.543815Z","shell.execute_reply":"2021-08-26T22:11:54.543276Z","shell.execute_reply.started":"2021-08-26T20:35:48.165454Z"},"papermill":{"duration":0.097033,"end_time":"2021-08-26T22:11:54.543969","exception":false,"start_time":"2021-08-26T22:11:54.446936","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for col in continuous_variables:\n    trans_df[f\"t_{col}\"]=np.log(1+np.power(df[col],0.25))","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:54.727473Z","iopub.status.busy":"2021-08-26T22:11:54.726599Z","iopub.status.idle":"2021-08-26T22:11:54.858013Z","shell.execute_reply":"2021-08-26T22:11:54.857453Z","shell.execute_reply.started":"2021-08-26T20:35:48.374306Z"},"papermill":{"duration":0.226016,"end_time":"2021-08-26T22:11:54.858176","exception":false,"start_time":"2021-08-26T22:11:54.632160","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"drop_cols=[\"SEQUENCE_NO\", \"PRACTICE_ENTRY\", \"PRACTICE_WINNINGS\", \"PRACTICE_ENTRY_NUMBER\", \"PRACTICE_WINNINGS_NUMBER\", \"CATEGORY_1\", \"CATEGORY_2\"]","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:55.042557Z","iopub.status.busy":"2021-08-26T22:11:55.041880Z","iopub.status.idle":"2021-08-26T22:11:55.045120Z","shell.execute_reply":"2021-08-26T22:11:55.044630Z","shell.execute_reply.started":"2021-08-26T20:35:48.579244Z"},"papermill":{"duration":0.097611,"end_time":"2021-08-26T22:11:55.045273","exception":false,"start_time":"2021-08-26T22:11:54.947662","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans_df=trans_df.drop(columns=continuous_variables+drop_cols,axis=1)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:55.228261Z","iopub.status.busy":"2021-08-26T22:11:55.227631Z","iopub.status.idle":"2021-08-26T22:11:55.253094Z","shell.execute_reply":"2021-08-26T22:11:55.252503Z","shell.execute_reply.started":"2021-08-26T20:35:48.823763Z"},"papermill":{"duration":0.119287,"end_time":"2021-08-26T22:11:55.253247","exception":false,"start_time":"2021-08-26T22:11:55.133960","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trans_df.head()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:55.527336Z","iopub.status.busy":"2021-08-26T22:11:55.526578Z","iopub.status.idle":"2021-08-26T22:11:55.530536Z","shell.execute_reply":"2021-08-26T22:11:55.529916Z","shell.execute_reply.started":"2021-08-26T20:35:49.024352Z"},"papermill":{"duration":0.11644,"end_time":"2021-08-26T22:11:55.530687","exception":false,"start_time":"2021-08-26T22:11:55.414247","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(trans_df.corr(),annot=True)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:55.715661Z","iopub.status.busy":"2021-08-26T22:11:55.714988Z","iopub.status.idle":"2021-08-26T22:11:57.848658Z","shell.execute_reply":"2021-08-26T22:11:57.849207Z","shell.execute_reply.started":"2021-08-26T20:35:49.195626Z"},"papermill":{"duration":2.230619,"end_time":"2021-08-26T22:11:57.849442","exception":false,"start_time":"2021-08-26T22:11:55.618823","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df,val_df=train_test_split(trans_df,test_size=0.26,stratify=trans_df[\"bins\"])","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:58.047577Z","iopub.status.busy":"2021-08-26T22:11:58.046576Z","iopub.status.idle":"2021-08-26T22:11:58.139602Z","shell.execute_reply":"2021-08-26T22:11:58.140073Z","shell.execute_reply.started":"2021-08-26T20:35:51.518517Z"},"papermill":{"duration":0.193772,"end_time":"2021-08-26T22:11:58.140294","exception":false,"start_time":"2021-08-26T22:11:57.946522","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y1_train=train_df[\"Y1\"].values\ny1_val=val_df[\"Y1\"].values\ny2_train=train_df[\"Y2\"].values\ny2_val=val_df[\"Y2\"].values","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:58.335923Z","iopub.status.busy":"2021-08-26T22:11:58.334938Z","iopub.status.idle":"2021-08-26T22:11:58.340425Z","shell.execute_reply":"2021-08-26T22:11:58.340872Z","shell.execute_reply.started":"2021-08-26T20:35:51.617179Z"},"papermill":{"duration":0.105532,"end_time":"2021-08-26T22:11:58.341068","exception":false,"start_time":"2021-08-26T22:11:58.235536","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train=train_df.drop(columns=[\"Y1\",\"Y2\",\"bins\"]).values\nX_val=val_df.drop(columns=[\"Y1\",\"Y2\",\"bins\"]).values","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:58.535735Z","iopub.status.busy":"2021-08-26T22:11:58.534797Z","iopub.status.idle":"2021-08-26T22:11:58.544755Z","shell.execute_reply":"2021-08-26T22:11:58.545430Z","shell.execute_reply.started":"2021-08-26T20:35:51.623760Z"},"papermill":{"duration":0.109847,"end_time":"2021-08-26T22:11:58.545641","exception":false,"start_time":"2021-08-26T22:11:58.435794","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# XGBOOST","metadata":{"papermill":{"duration":0.09566,"end_time":"2021-08-26T22:11:58.736231","exception":false,"start_time":"2021-08-26T22:11:58.640571","status":"completed"},"tags":[]}},{"cell_type":"code","source":"xgb1=XGBRegressor(n_estimators=600, max_depth=8 ,verbosity=0,learning_rate=0.15)\nxgb1.fit(X_train,y1_train)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:11:58.933600Z","iopub.status.busy":"2021-08-26T22:11:58.932477Z","iopub.status.idle":"2021-08-26T22:12:21.208170Z","shell.execute_reply":"2021-08-26T22:12:21.206641Z","shell.execute_reply.started":"2021-08-26T21:29:46.253864Z"},"papermill":{"duration":22.376535,"end_time":"2021-08-26T22:12:21.208341","exception":false,"start_time":"2021-08-26T22:11:58.831806","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pred_val=xgb1.predict(X_val)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:21.410711Z","iopub.status.busy":"2021-08-26T22:12:21.409798Z","iopub.status.idle":"2021-08-26T22:12:21.478533Z","shell.execute_reply":"2021-08-26T22:12:21.479107Z","shell.execute_reply.started":"2021-08-26T21:30:08.756839Z"},"papermill":{"duration":0.173241,"end_time":"2021-08-26T22:12:21.479327","exception":false,"start_time":"2021-08-26T22:12:21.306086","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mean_squared_error(y1_val, pred_val, squared=False)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:21.679949Z","iopub.status.busy":"2021-08-26T22:12:21.679201Z","iopub.status.idle":"2021-08-26T22:12:21.685280Z","shell.execute_reply":"2021-08-26T22:12:21.684787Z","shell.execute_reply.started":"2021-08-26T21:30:08.833985Z"},"papermill":{"duration":0.108144,"end_time":"2021-08-26T22:12:21.685458","exception":false,"start_time":"2021-08-26T22:12:21.577314","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"xgb2=XGBRegressor()\nxgb2.fit(X_train,y2_train)\npred_val=xgb2.predict(X_val)\nmean_squared_error(y2_val, pred_val, squared=False)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:21.891484Z","iopub.status.busy":"2021-08-26T22:12:21.890776Z","iopub.status.idle":"2021-08-26T22:12:29.132949Z","shell.execute_reply":"2021-08-26T22:12:29.133836Z","shell.execute_reply.started":"2021-08-26T19:55:42.713511Z"},"papermill":{"duration":7.352166,"end_time":"2021-08-26T22:12:29.134050","exception":false,"start_time":"2021-08-26T22:12:21.781884","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df=pd.read_csv(\"../input/beyond-analysis/test.csv\")\ntest_df","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:29.331722Z","iopub.status.busy":"2021-08-26T22:12:29.331074Z","iopub.status.idle":"2021-08-26T22:12:32.190645Z","shell.execute_reply":"2021-08-26T22:12:32.191134Z","shell.execute_reply.started":"2021-08-26T20:40:21.696307Z"},"papermill":{"duration":2.960387,"end_time":"2021-08-26T22:12:32.191323","exception":false,"start_time":"2021-08-26T22:12:29.230936","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df=test_df.groupby([\"UNIQUE_IDENTIFIER\"]).mean()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:32.401614Z","iopub.status.busy":"2021-08-26T22:12:32.400931Z","iopub.status.idle":"2021-08-26T22:12:32.606612Z","shell.execute_reply":"2021-08-26T22:12:32.606055Z","shell.execute_reply.started":"2021-08-26T20:40:24.643482Z"},"papermill":{"duration":0.317702,"end_time":"2021-08-26T22:12:32.606774","exception":false,"start_time":"2021-08-26T22:12:32.289072","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(len(test_df))","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:32.802467Z","iopub.status.busy":"2021-08-26T22:12:32.801844Z","iopub.status.idle":"2021-08-26T22:12:32.805602Z","shell.execute_reply":"2021-08-26T22:12:32.805085Z","shell.execute_reply.started":"2021-08-26T20:40:24.879036Z"},"papermill":{"duration":0.103815,"end_time":"2021-08-26T22:12:32.805744","exception":false,"start_time":"2021-08-26T22:12:32.701929","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for col in continuous_variables:\n    test_df[f\"t_{col}\"]=np.log(1+np.power(test_df[col],0.2))","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:33.002677Z","iopub.status.busy":"2021-08-26T22:12:33.001984Z","iopub.status.idle":"2021-08-26T22:12:33.076677Z","shell.execute_reply":"2021-08-26T22:12:33.077169Z","shell.execute_reply.started":"2021-08-26T20:40:24.887856Z"},"papermill":{"duration":0.175618,"end_time":"2021-08-26T22:12:33.077396","exception":false,"start_time":"2021-08-26T22:12:32.901778","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df.head()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:33.278841Z","iopub.status.busy":"2021-08-26T22:12:33.278111Z","iopub.status.idle":"2021-08-26T22:12:33.307621Z","shell.execute_reply":"2021-08-26T22:12:33.308085Z","shell.execute_reply.started":"2021-08-26T20:40:24.952214Z"},"papermill":{"duration":0.131551,"end_time":"2021-08-26T22:12:33.308286","exception":false,"start_time":"2021-08-26T22:12:33.176735","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"drop_cols_test=[\"SEQUENCE_NO\", \"PRACTICE_ENTRY\", \"PRACTICE_WINNINGS\", \"PRACTICE_ENTRY_NUMBER\", \"PRACTICE_WINNINGS_NUMBER\"]","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:33.508025Z","iopub.status.busy":"2021-08-26T22:12:33.507349Z","iopub.status.idle":"2021-08-26T22:12:33.510449Z","shell.execute_reply":"2021-08-26T22:12:33.510907Z","shell.execute_reply.started":"2021-08-26T20:40:24.986971Z"},"papermill":{"duration":0.105819,"end_time":"2021-08-26T22:12:33.511103","exception":false,"start_time":"2021-08-26T22:12:33.405284","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df=test_df.drop(columns=continuous_variables+drop_cols_test,axis=1)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:33.709796Z","iopub.status.busy":"2021-08-26T22:12:33.709138Z","iopub.status.idle":"2021-08-26T22:12:33.728215Z","shell.execute_reply":"2021-08-26T22:12:33.728761Z","shell.execute_reply.started":"2021-08-26T20:40:24.997325Z"},"papermill":{"duration":0.119308,"end_time":"2021-08-26T22:12:33.728939","exception":false,"start_time":"2021-08-26T22:12:33.609631","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df.head()","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:33.927671Z","iopub.status.busy":"2021-08-26T22:12:33.926998Z","iopub.status.idle":"2021-08-26T22:12:33.949955Z","shell.execute_reply":"2021-08-26T22:12:33.950507Z","shell.execute_reply.started":"2021-08-26T20:40:25.022554Z"},"papermill":{"duration":0.124226,"end_time":"2021-08-26T22:12:33.950681","exception":false,"start_time":"2021-08-26T22:12:33.826455","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test=test_df.values\ny1_pred_xgb=xgb1.predict(X_test)\ny2_pred_xgb=xgb2.predict(X_test)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:34.153437Z","iopub.status.busy":"2021-08-26T22:12:34.152771Z","iopub.status.idle":"2021-08-26T22:12:34.430995Z","shell.execute_reply":"2021-08-26T22:12:34.431585Z","shell.execute_reply.started":"2021-08-26T20:40:25.052182Z"},"papermill":{"duration":0.38254,"end_time":"2021-08-26T22:12:34.431790","exception":false,"start_time":"2021-08-26T22:12:34.049250","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ids=list(test_df.index)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:34.667582Z","iopub.status.busy":"2021-08-26T22:12:34.666086Z","iopub.status.idle":"2021-08-26T22:12:34.669674Z","shell.execute_reply":"2021-08-26T22:12:34.669153Z","shell.execute_reply.started":"2021-08-26T20:40:25.126774Z"},"papermill":{"duration":0.137423,"end_time":"2021-08-26T22:12:34.669832","exception":false,"start_time":"2021-08-26T22:12:34.532409","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# CATBOOST","metadata":{"papermill":{"duration":0.098599,"end_time":"2021-08-26T22:12:35.734917","exception":false,"start_time":"2021-08-26T22:12:35.636318","status":"completed"},"tags":[]}},{"cell_type":"code","source":"cat2=CatBoostRegressor(depth=8, learning_rate=0.15)\ncat2.fit(X_train,y2_train,eval_set=(X_val,y2_val))\npred_val=cat2.predict(X_val)\nmean_squared_error(y2_val, pred_val, squared=False)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:35.969128Z","iopub.status.busy":"2021-08-26T22:12:35.967257Z","iopub.status.idle":"2021-08-26T22:12:50.638252Z","shell.execute_reply":"2021-08-26T22:12:50.637581Z","shell.execute_reply.started":"2021-08-26T21:41:50.140922Z"},"papermill":{"duration":14.803433,"end_time":"2021-08-26T22:12:50.638448","exception":false,"start_time":"2021-08-26T22:12:35.835015","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cat1=CatBoostRegressor(depth=5, learning_rate=0.05)\ncat1.fit(X_train,y1_train,eval_set=(X_val,y1_val))\npred_val=cat1.predict(X_val)\nmean_squared_error(y1_val, pred_val, squared=False)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:12:50.909894Z","iopub.status.busy":"2021-08-26T22:12:50.908868Z","iopub.status.idle":"2021-08-26T22:13:00.505401Z","shell.execute_reply":"2021-08-26T22:13:00.504772Z","shell.execute_reply.started":"2021-08-26T21:48:11.397815Z"},"papermill":{"duration":9.742747,"end_time":"2021-08-26T22:13:00.505568","exception":false,"start_time":"2021-08-26T22:12:50.762821","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test=test_df.values\ny1_pred_cat=cat1.predict(X_test)\ny2_pred_cat=cat2.predict(X_test)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:13:00.789728Z","iopub.status.busy":"2021-08-26T22:13:00.788902Z","iopub.status.idle":"2021-08-26T22:13:00.856889Z","shell.execute_reply":"2021-08-26T22:13:00.856271Z","shell.execute_reply.started":"2021-08-26T21:50:56.964440Z"},"papermill":{"duration":0.212173,"end_time":"2021-08-26T22:13:00.857041","exception":false,"start_time":"2021-08-26T22:13:00.644868","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# LGBM","metadata":{"papermill":{"duration":0.14081,"end_time":"2021-08-26T22:13:02.206725","exception":false,"start_time":"2021-08-26T22:13:02.065915","status":"completed"},"tags":[]}},{"cell_type":"code","source":"lgbm2=LGBMRegressor()\nlgbm2.fit(X_train,y2_train,eval_set=(X_val,y2_val))\npred_val=lgbm2.predict(X_val)\nmean_squared_error(y2_val, pred_val, squared=False)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:13:02.497221Z","iopub.status.busy":"2021-08-26T22:13:02.496494Z","iopub.status.idle":"2021-08-26T22:13:03.352620Z","shell.execute_reply":"2021-08-26T22:13:03.353172Z","shell.execute_reply.started":"2021-08-26T21:57:24.378232Z"},"papermill":{"duration":1.002514,"end_time":"2021-08-26T22:13:03.353397","exception":false,"start_time":"2021-08-26T22:13:02.350883","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"lgbm1=LGBMRegressor()\nlgbm1.fit(X_train,y1_train,eval_set=(X_val,y1_val))\npred_val=lgbm1.predict(X_val)\nmean_squared_error(y1_val, pred_val, squared=False)","metadata":{"execution":{"iopub.execute_input":"2021-08-26T22:13:03.641182Z","iopub.status.busy":"2021-08-26T22:13:03.640556Z","iopub.status.idle":"2021-08-26T22:13:04.327811Z","shell.execute_reply":"2021-08-26T22:13:04.328423Z","shell.execute_reply.started":"2021-08-26T21:58:24.048775Z"},"papermill":{"duration":0.832775,"end_time":"2021-08-26T22:13:04.328633","exception":false,"start_time":"2021-08-26T22:13:03.495858","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_test=test_df.values\ny1_pred_lgbm=lgbm1.predict(X_test)\ny2_pred_lgbm=lgbm2.predict(X_test)\n","metadata":{"papermill":{"duration":0.140167,"end_time":"2021-08-26T22:13:04.612471","exception":false,"start_time":"2021-08-26T22:13:04.472304","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y1_pred = (y1_pred_xgb +  y1_pred_cat +  y1_pred_lgbm)/3\ny2_pred = (y2_pred_xgb +  y2_pred_cat +  y2_pred_lgbm)/3","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ids=list(test_df.index)\nsub=pd.DataFrame(columns=[\"UNIQUE_IDENTIFIER\",\"Y1\",\"Y2\"])\nsub[\"UNIQUE_IDENTIFIER\"]=ids\nsub[\"Y1\"]=np.clip(y1_pred,0,1e9)\nsub[\"Y2\"]=np.clip(y2_pred,0,1e9)\nsub.head()","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub.to_csv(\"submission.csv\",index=None)","metadata":{},"execution_count":null,"outputs":[]}]}