{"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":"# **Blending of five submission**\n## **If the work is useful to you, don't forget to upvote !**\n## This note blending the following submission.\n## This note is a new submission based on the note below\nhttps://www.kaggle.com/code/royalacecat/lb-0-855-upvote-the-example-of-ensemble\n\n## submission1.csv\nLB:  - https://www.kaggle.com/code/ambrosm/msci-citeseq-quickstart/notebook\n## submission2.csv\nLB:  - https://www.kaggle.com/code/ravishah1/citeseq-rna-to-protein-encoder-decoder-nn\n## submission3.csv\nLB:  - https://www.kaggle.com/code/jsmithperera/multiome-quickstart-w-sparse-m-tsvd-32\n## submission4.csv\nLB:  - https://www.kaggle.com/code/ambrosm/msci-citeseq-keras-quickstart\n## submission5.csv\nLB:  - https://www.kaggle.com/code/sskknt/msci-citeseq-keras-quickstart-dropout/data?scriptVersionId=105219293","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":"markdown","source":"# The idea of normalization is based on this notebook.\nhttps://www.kaggle.com/code/vslaykovsky/lb-0-858-normalized-ensembles-for-pearson-s-r","metadata":{}},{"cell_type":"code","source":"import numpy as np \nimport pandas as pd \nimport glob","metadata":{"execution":{"iopub.status.busy":"2022-09-09T04:27:35.001111Z","iopub.execute_input":"2022-09-09T04:27:35.002032Z","iopub.status.idle":"2022-09-09T04:27:35.034678Z","shell.execute_reply.started":"2022-09-09T04:27:35.001886Z","shell.execute_reply":"2022-09-09T04:27:35.033707Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"paths = ['../input/ensemble/submission1.csv',\n         '../input/ensemble/submission2.csv',\n         '../input/ensemble/submission3.csv',\n         \"../input/keras848swimmy/submission.csv\",\n        \"../input/kerasdropsubmission810/submission.csv\"]","metadata":{"execution":{"iopub.status.busy":"2022-09-09T04:27:35.036687Z","iopub.execute_input":"2022-09-09T04:27:35.037344Z","iopub.status.idle":"2022-09-09T04:27:35.04305Z","shell.execute_reply.started":"2022-09-09T04:27:35.037308Z","shell.execute_reply":"2022-09-09T04:27:35.04109Z"},"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-09T04:27:35.044696Z","iopub.execute_input":"2022-09-09T04:27:35.045639Z","iopub.status.idle":"2022-09-09T04:29:47.191167Z","shell.execute_reply.started":"2022-09-09T04:27:35.045588Z","shell.execute_reply":"2022-09-09T04:29:47.189495Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def std(x):\n    return (x - np.mean(x)) / np.std(x)","metadata":{"execution":{"iopub.status.busy":"2022-09-09T04:29:47.19338Z","iopub.execute_input":"2022-09-09T04:29:47.193931Z","iopub.status.idle":"2022-09-09T04:29:47.201064Z","shell.execute_reply.started":"2022-09-09T04:29:47.19389Z","shell.execute_reply":"2022-09-09T04:29:47.19953Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# pred_ensembled = 0.09 * (0.9 * std(dfs[0]['target']) + 0.10 * std(dfs[1]['target'])) + 0.01 * std(dfs[2]['target']) + 0.9 * std(dfs[3]['target'])","metadata":{"execution":{"iopub.status.busy":"2022-09-09T04:29:47.203684Z","iopub.execute_input":"2022-09-09T04:29:47.204138Z","iopub.status.idle":"2022-09-09T04:29:47.213128Z","shell.execute_reply.started":"2022-09-09T04:29:47.204103Z","shell.execute_reply":"2022-09-09T04:29:47.211965Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pred_ensembled = (-1)*0 * std(dfs[0]['target']) + (-1)*0 * std(dfs[1]['target']) + (1)*0 * std(dfs[2]['target']) + (1)*0.01 * std(dfs[3]['target']) + 0.99 * (dfs[4]['target'])","metadata":{"execution":{"iopub.status.busy":"2022-09-09T04:31:31.511431Z","iopub.execute_input":"2022-09-09T04:31:31.511871Z","iopub.status.idle":"2022-09-09T04:31:38.771148Z","shell.execute_reply.started":"2022-09-09T04:31:31.511838Z","shell.execute_reply":"2022-09-09T04:31:38.769553Z"},"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-09T04:29:47.230249Z","iopub.status.idle":"2022-09-09T04:29:47.231507Z","shell.execute_reply.started":"2022-09-09T04:29:47.231284Z","shell.execute_reply":"2022-09-09T04:29:47.231309Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit['target'] = pred_ensembled","metadata":{"execution":{"iopub.status.busy":"2022-09-09T04:29:47.232797Z","iopub.status.idle":"2022-09-09T04:29:47.233202Z","shell.execute_reply.started":"2022-09-09T04:29:47.232993Z","shell.execute_reply":"2022-09-09T04:29:47.23301Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit","metadata":{"execution":{"iopub.status.busy":"2022-09-09T04:29:47.235174Z","iopub.status.idle":"2022-09-09T04:29:47.236073Z","shell.execute_reply.started":"2022-09-09T04:29:47.235852Z","shell.execute_reply":"2022-09-09T04:29:47.235876Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit.to_csv('5in1_ensemble.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2022-09-09T04:29:47.237382Z","iopub.status.idle":"2022-09-09T04:29:47.238111Z","shell.execute_reply.started":"2022-09-09T04:29:47.237893Z","shell.execute_reply":"2022-09-09T04:29:47.237917Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"submit.to_csv('4in1_ensemble.csv', index=False)","metadata":{}}]}