{"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-25T20:26:46.705949Z","iopub.execute_input":"2022-10-25T20:26:46.706413Z","iopub.status.idle":"2022-10-25T20:26:46.738222Z","shell.execute_reply.started":"2022-10-25T20:26:46.706322Z","shell.execute_reply":"2022-10-25T20:26:46.736885Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"paths = ['../input/mmscel-crossvalidation-schemes-sim-features/submission_cite_seq_CVschemesV26Add9featfiles_PCA_RescaleY_RidgeAlpha1e4Ndim100_multiome_sskknts_KerDrop.csv',\n         '../input/cite-seq-mlp-submit/submission.csv',\n         '../input/fork-of-mmscel-crossvalidation-schemes/submission_cite_seq_CVschemesV14tryPCA_addMetaAndKmeans_RescaleY_RidgeAlpha1e4Ndim100_multiome_sskknts_KerDrop.csv']","metadata":{"execution":{"iopub.status.busy":"2022-10-25T20:29:27.028437Z","iopub.execute_input":"2022-10-25T20:29:27.029288Z","iopub.status.idle":"2022-10-25T20:29:27.035751Z","shell.execute_reply.started":"2022-10-25T20:29:27.029246Z","shell.execute_reply":"2022-10-25T20:29:27.034366Z"},"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-25T20:29:29.440160Z","iopub.execute_input":"2022-10-25T20:29:29.440597Z","iopub.status.idle":"2022-10-25T20:31:00.021558Z","shell.execute_reply.started":"2022-10-25T20:29:29.440562Z","shell.execute_reply":"2022-10-25T20:31:00.020176Z"},"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-25T20:31:00.024040Z","iopub.execute_input":"2022-10-25T20:31:00.024919Z","iopub.status.idle":"2022-10-25T20:31:00.031463Z","shell.execute_reply.started":"2022-10-25T20:31:00.024870Z","shell.execute_reply":"2022-10-25T20:31:00.030145Z"},"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']) + (2/4)*std(dfs[1]['target']) + (1/4)*std(dfs[2]['target'])","metadata":{"execution":{"iopub.status.busy":"2022-10-25T20:31:00.032862Z","iopub.execute_input":"2022-10-25T20:31:00.033832Z","iopub.status.idle":"2022-10-25T20:31:03.995694Z","shell.execute_reply.started":"2022-10-25T20:31:00.033787Z","shell.execute_reply":"2022-10-25T20:31:03.994567Z"},"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-25T20:32:07.167869Z","iopub.execute_input":"2022-10-25T20:32:07.170237Z","iopub.status.idle":"2022-10-25T20:32:29.147076Z","shell.execute_reply.started":"2022-10-25T20:32:07.170177Z","shell.execute_reply":"2022-10-25T20:32:29.144896Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submit['target'] = pred_ensembled","metadata":{"execution":{"iopub.status.busy":"2022-10-25T20:32:29.153010Z","iopub.execute_input":"2022-10-25T20:32:29.153526Z","iopub.status.idle":"2022-10-25T20:32:29.525243Z","shell.execute_reply.started":"2022-10-25T20:32:29.153486Z","shell.execute_reply":"2022-10-25T20:32:29.523542Z"},"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_CATBOOST_RIDGE_ensemble.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2022-10-25T20:32:29.527005Z","iopub.execute_input":"2022-10-25T20:32:29.527428Z"},"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":{}}]}