{"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 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-10-29T07:51:48.230870Z","iopub.execute_input":"2022-10-29T07:51:48.231269Z","iopub.status.idle":"2022-10-29T07:51:48.235707Z","shell.execute_reply.started":"2022-10-29T07:51:48.231237Z","shell.execute_reply":"2022-10-29T07:51:48.234562Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"paths = [\n    '../input/mmscel-crossvalidation-schemes-sim-features/submission_cite_seq_CVschemesV26Add9featfiles_PCA_RescaleY_RidgeAlpha1e4Ndim100_multiome_sskknts_KerDrop.csv',\n    '../input/cite-seq-2-inputs-tsvd-108-imp-genes-best-layers/submission.csv',\n    '../input/cite-seq-mlp-submit/submission.csv'\n]","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:51:48.198871Z","iopub.execute_input":"2022-10-29T07:51:48.199506Z","iopub.status.idle":"2022-10-29T07:51:48.228644Z","shell.execute_reply.started":"2022-10-29T07:51:48.199424Z","shell.execute_reply":"2022-10-29T07:51:48.227332Z"},"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-10-29T07:51:48.236715Z","iopub.execute_input":"2022-10-29T07:51:48.237629Z","iopub.status.idle":"2022-10-29T07:53:05.921835Z","shell.execute_reply.started":"2022-10-29T07:51:48.237595Z","shell.execute_reply":"2022-10-29T07:53:05.919925Z"},"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-10-29T07:53:05.925588Z","iopub.execute_input":"2022-10-29T07:53:05.925996Z","iopub.status.idle":"2022-10-29T07:53:05.932670Z","shell.execute_reply.started":"2022-10-29T07:53:05.925962Z","shell.execute_reply":"2022-10-29T07:53:05.931758Z"},"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-10-25T12:45:54.340742Z","iopub.execute_input":"2022-10-25T12:45:54.341135Z","iopub.status.idle":"2022-10-25T12:45:54.352146Z","shell.execute_reply.started":"2022-10-25T12:45:54.341091Z","shell.execute_reply":"2022-10-25T12:45:54.351094Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pred_ensembled = (1/4)*std(dfs[0]['target']) + (3/8)*std(dfs[1]['target']) + (3/8)*std(dfs[1]['target'])","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:53:05.934104Z","iopub.execute_input":"2022-10-29T07:53:05.934449Z","iopub.status.idle":"2022-10-29T07:53:07.859419Z","shell.execute_reply.started":"2022-10-29T07:53:05.934418Z","shell.execute_reply":"2022-10-29T07:53:07.858229Z"},"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-10-29T07:53:07.861197Z","iopub.execute_input":"2022-10-29T07:53:07.861568Z","iopub.status.idle":"2022-10-29T07:53:24.461501Z","shell.execute_reply.started":"2022-10-29T07:53:07.861537Z","shell.execute_reply":"2022-10-29T07:53:24.460216Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit['target'] = pred_ensembled","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:53:24.463419Z","iopub.execute_input":"2022-10-29T07:53:24.463825Z","iopub.status.idle":"2022-10-29T07:53:24.564777Z","shell.execute_reply.started":"2022-10-29T07:53:24.463789Z","shell.execute_reply":"2022-10-29T07:53:24.563175Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit","metadata":{"execution":{"iopub.status.busy":"2022-10-25T12:46:21.110725Z","iopub.execute_input":"2022-10-25T12:46:21.111044Z","iopub.status.idle":"2022-10-25T12:46:21.135291Z","shell.execute_reply.started":"2022-10-25T12:46:21.111016Z","shell.execute_reply":"2022-10-25T12:46:21.134245Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit.to_csv('MLP_RIDGE_ensemble.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:53:24.985696Z","iopub.execute_input":"2022-10-29T07:53:24.986081Z","iopub.status.idle":"2022-10-29T07:55:16.543249Z","shell.execute_reply.started":"2022-10-29T07:53:24.986051Z","shell.execute_reply":"2022-10-29T07:55:16.542026Z"},"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":{}}]}