{"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":"markdown","source":"In this notebook, we leverage the two different models that we developed previously, [one with lightgbm](https://www.kaggle.com/code/stautxie/tp-oct-2022-lightgbm), [one with catboost](https://www.kaggle.com/code/stautxie/tabular-playground-oct-2022-catboost) and [one with tabnet](https://www.kaggle.com/code/stautxie/tabular-playground-oct-2022-tabnet). We will make use a simple blending scheme to show the results improves.","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nimport os","metadata":{"execution":{"iopub.status.busy":"2022-10-03T22:02:38.816242Z","iopub.execute_input":"2022-10-03T22:02:38.816696Z","iopub.status.idle":"2022-10-03T22:02:38.822216Z","shell.execute_reply.started":"2022-10-03T22:02:38.816656Z","shell.execute_reply":"2022-10-03T22:02:38.820709Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"LGB_DIR = \"../input/tp-oct-2022-lgb\"\nCAT_DIR = \"../input/tp202210-cat\"\nTAB_DIR = \"../input/tp202210-cat\"","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-10-03T22:02:43.465386Z","iopub.execute_input":"2022-10-03T22:02:43.465850Z","iopub.status.idle":"2022-10-03T22:02:43.471503Z","shell.execute_reply.started":"2022-10-03T22:02:43.465810Z","shell.execute_reply":"2022-10-03T22:02:43.470099Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"lgb_submit = pd.read_csv(os.path.join(LGB_DIR, \"submission.csv\"))","metadata":{"execution":{"iopub.status.busy":"2022-10-03T22:02:43.473092Z","iopub.execute_input":"2022-10-03T22:02:43.473494Z","iopub.status.idle":"2022-10-03T22:02:44.208520Z","shell.execute_reply.started":"2022-10-03T22:02:43.473439Z","shell.execute_reply":"2022-10-03T22:02:44.207244Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cat_submit = pd.read_csv(os.path.join(CAT_DIR, \"submission.csv\"))","metadata":{"execution":{"iopub.status.busy":"2022-10-03T22:02:44.210030Z","iopub.execute_input":"2022-10-03T22:02:44.211184Z","iopub.status.idle":"2022-10-03T22:02:44.861803Z","shell.execute_reply.started":"2022-10-03T22:02:44.211135Z","shell.execute_reply":"2022-10-03T22:02:44.860852Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tab_submit = pd.read_csv(os.path.join(TAB_DIR, \"submission.csv\"))","metadata":{"execution":{"iopub.status.busy":"2022-10-03T22:02:44.863356Z","iopub.execute_input":"2022-10-03T22:02:44.863739Z","iopub.status.idle":"2022-10-03T22:02:45.177214Z","shell.execute_reply.started":"2022-10-03T22:02:44.863705Z","shell.execute_reply":"2022-10-03T22:02:45.175968Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit_df = pd.concat([lgb_submit.rename(columns={'team_A_scoring_within_10sec':'team_A_lgb',\n                                                   'team_B_scoring_within_10sec': 'team_B_lgb'}), \n                       cat_submit[['team_A_scoring_within_10sec', \n                                   'team_B_scoring_within_10sec']].rename(\n                           columns={'team_A_scoring_within_10sec':'team_A_cat',\n                                   'team_B_scoring_within_10sec': 'team_B_cat'}),\n                       tab_submit[['team_A_scoring_within_10sec', \n                                   'team_B_scoring_within_10sec']].rename(\n                           columns={'team_A_scoring_within_10sec':'team_A_tab',\n                                   'team_B_scoring_within_10sec': 'team_B_tab'})], axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-10-03T22:03:20.732064Z","iopub.execute_input":"2022-10-03T22:03:20.732511Z","iopub.status.idle":"2022-10-03T22:03:20.808770Z","shell.execute_reply.started":"2022-10-03T22:03:20.732472Z","shell.execute_reply":"2022-10-03T22:03:20.807578Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit_df","metadata":{"execution":{"iopub.status.busy":"2022-10-03T22:03:26.938303Z","iopub.execute_input":"2022-10-03T22:03:26.939092Z","iopub.status.idle":"2022-10-03T22:03:26.963673Z","shell.execute_reply.started":"2022-10-03T22:03:26.939052Z","shell.execute_reply":"2022-10-03T22:03:26.962530Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit_df['team_A_scoring_within_10sec'] = 1/3.0 * (submit_df['team_A_lgb'] + submit_df['team_A_cat'] + submit_df['team_A_tab'])\nsubmit_df['team_B_scoring_within_10sec'] = 1/3.0 * (submit_df['team_B_lgb'] + submit_df['team_B_cat'] + submit_df['team_B_tab'])","metadata":{"execution":{"iopub.status.busy":"2022-10-03T22:04:35.226982Z","iopub.execute_input":"2022-10-03T22:04:35.227479Z","iopub.status.idle":"2022-10-03T22:04:35.249366Z","shell.execute_reply.started":"2022-10-03T22:04:35.227420Z","shell.execute_reply":"2022-10-03T22:04:35.248205Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit_df","metadata":{"execution":{"iopub.status.busy":"2022-10-03T22:04:37.911437Z","iopub.execute_input":"2022-10-03T22:04:37.911871Z","iopub.status.idle":"2022-10-03T22:04:37.934336Z","shell.execute_reply.started":"2022-10-03T22:04:37.911836Z","shell.execute_reply":"2022-10-03T22:04:37.933081Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit_df[['id', 'team_A_scoring_within_10sec', 'team_B_scoring_within_10sec']].to_csv(\"submission.csv\", index=None)","metadata":{"execution":{"iopub.status.busy":"2022-10-03T02:30:22.687954Z","iopub.execute_input":"2022-10-03T02:30:22.688355Z","iopub.status.idle":"2022-10-03T02:30:25.668441Z","shell.execute_reply.started":"2022-10-03T02:30:22.688322Z","shell.execute_reply":"2022-10-03T02:30:25.667227Z"},"trusted":true},"execution_count":null,"outputs":[]}]}