{"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":"# The example of ensemble\n## If the work is useful to you, don't forget to upvote !\n## submission1.csv\nLB: 0.853 - https://www.kaggle.com/code/ambrosm/msci-citeseq-quickstart/notebook\n## submission2.csv\nLB: 0.849 - https://www.kaggle.com/code/ravishah1/citeseq-rna-to-protein-encoder-decoder-nn\n## submission3.csv\nLB: 0.848 - https://www.kaggle.com/code/jsmithperera/multiome-quickstart-w-sparse-m-tsvd-32\n## Result: LB:0.855","metadata":{"execution":{"iopub.status.busy":"2022-09-04T06:45:40.520477Z","iopub.execute_input":"2022-09-04T06:45:40.521256Z","iopub.status.idle":"2022-09-04T06:45:40.551882Z","shell.execute_reply.started":"2022-09-04T06:45:40.521157Z","shell.execute_reply":"2022-09-04T06:45:40.549459Z"}}},{"cell_type":"code","source":"import numpy as np \nimport pandas as pd \nimport glob","metadata":{"execution":{"iopub.status.busy":"2022-09-04T07:56:24.844620Z","iopub.execute_input":"2022-09-04T07:56:24.845449Z","iopub.status.idle":"2022-09-04T07:56:24.869158Z","shell.execute_reply.started":"2022-09-04T07:56:24.845323Z","shell.execute_reply":"2022-09-04T07:56:24.868199Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"paths = ['../input/ensemble/submission1.csv','../input/ensemble/submission2.csv','../input/ensemble/submission3.csv']","metadata":{"execution":{"iopub.status.busy":"2022-09-04T07:56:24.870922Z","iopub.execute_input":"2022-09-04T07:56:24.871335Z","iopub.status.idle":"2022-09-04T07:56:24.876282Z","shell.execute_reply.started":"2022-09-04T07:56:24.871300Z","shell.execute_reply":"2022-09-04T07:56:24.874986Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dfs = [pd.read_csv(x) for x in paths]","metadata":{"execution":{"iopub.status.busy":"2022-09-04T07:56:24.877933Z","iopub.execute_input":"2022-09-04T07:56:24.878520Z","iopub.status.idle":"2022-09-04T07:57:26.379565Z","shell.execute_reply.started":"2022-09-04T07:56:24.878486Z","shell.execute_reply":"2022-09-04T07:57:26.378587Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pred_ensembled = 0.9 * (0.9 * dfs[0]['target']  + 0.1 * dfs[1]['target']) + 0.1 * dfs[2]['target']","metadata":{"execution":{"iopub.status.busy":"2022-09-04T07:57:26.382404Z","iopub.execute_input":"2022-09-04T07:57:26.382780Z","iopub.status.idle":"2022-09-04T07:57:27.300164Z","shell.execute_reply.started":"2022-09-04T07:57:26.382743Z","shell.execute_reply":"2022-09-04T07:57:27.299140Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit = pd.read_csv('../input/open-problems-multimodal/sample_submission.csv')","metadata":{"execution":{"iopub.status.busy":"2022-09-04T07:57:27.301609Z","iopub.execute_input":"2022-09-04T07:57:27.301978Z","iopub.status.idle":"2022-09-04T07:57:42.679401Z","shell.execute_reply.started":"2022-09-04T07:57:27.301941Z","shell.execute_reply":"2022-09-04T07:57:42.678425Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit['target'] = pred_ensembled","metadata":{"execution":{"iopub.status.busy":"2022-09-04T07:57:42.680801Z","iopub.execute_input":"2022-09-04T07:57:42.682145Z","iopub.status.idle":"2022-09-04T07:57:42.996610Z","shell.execute_reply.started":"2022-09-04T07:57:42.682107Z","shell.execute_reply":"2022-09-04T07:57:42.995584Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit","metadata":{"execution":{"iopub.status.busy":"2022-09-04T07:57:42.998110Z","iopub.execute_input":"2022-09-04T07:57:42.999604Z","iopub.status.idle":"2022-09-04T07:57:43.019296Z","shell.execute_reply.started":"2022-09-04T07:57:42.999566Z","shell.execute_reply":"2022-09-04T07:57:43.018297Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit.to_csv('3in1_ensemble.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2022-09-04T07:57:43.022610Z","iopub.execute_input":"2022-09-04T07:57:43.022879Z","iopub.status.idle":"2022-09-04T07:59:51.293521Z","shell.execute_reply.started":"2022-09-04T07:57:43.022855Z","shell.execute_reply":"2022-09-04T07:59:51.292519Z"},"trusted":true},"execution_count":null,"outputs":[]}]}