{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":96164,"databundleVersionId":12993472,"sourceType":"competition"},{"sourceId":12514482,"sourceType":"datasetVersion","datasetId":7899099},{"sourceId":251314656,"sourceType":"kernelVersion"}],"dockerImageVersionId":31089,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"* **submission_95109** from [@ZULQAR.](https://www.kaggle.com/code/johndoe2011/ensemble-public-lb-0-95109)\n* **submission_95004** from [@ducknew](https://www.kaggle.com/code/ducknew/drw-blend-h-v-remix-higher-changepoint)\n* **submission_95002** from [@Taylor S. Amarel](https://www.kaggle.com/code/taylorsamarel/drw-blend-horizontal-blend-vertical-remix)\n* **submission_94857** from [@Alex GUAN](https://www.kaggle.com/code/guanyuzhen/drw-crypto-ensemble)\n---\n* **Public LB 0.95117**: 0.7 0.1 0.1 0.1\n* **Public LB 0.95125**: 0.8 0.05 0.05 0.1\n* **Public LB 0.95129**: 0.85 0.05 0.05 0.05","metadata":{"execution":{"iopub.status.busy":"2025-07-19T08:34:52.765657Z","iopub.execute_input":"2025-07-19T08:34:52.766485Z","iopub.status.idle":"2025-07-19T08:34:52.772294Z","shell.execute_reply.started":"2025-07-19T08:34:52.766455Z","shell.execute_reply":"2025-07-19T08:34:52.770951Z"}}},{"cell_type":"code","source":"import pandas as pd\n\n# Load the predictions\ndf1 = pd.read_csv('/kaggle/input/drw0719/submission_95109.csv')\ndf2 = pd.read_csv('/kaggle/input/drw0719/submission_95004.csv')\ndf3 = pd.read_csv('/kaggle/input/drw0719/submission_95002.csv')\ndf4 = pd.read_csv('/kaggle/input/drw0719/submission_94857.csv')\n\n# Assign weights (customize these)\nweights = {\n    'df1': 0.85,\n    'df2': 0.05,\n    'df3': 0.05,\n    'df4': 0.05\n}\n\n# Rename prediction columns to avoid collision\ndf1.rename(columns={'prediction': 'df1'}, inplace=True)\ndf2.rename(columns={'prediction': 'df2'}, inplace=True)\ndf3.rename(columns={'prediction': 'df3'}, inplace=True)\ndf4.rename(columns={'prediction': 'df4'}, inplace=True)\n\n# Merge all on 'ID'\ndf = df1.merge(df2, on='ID') \\\n        .merge(df3, on='ID') \\\n        .merge(df4, on='ID')\n\n# Compute weighted average\ndf['prediction'] = (\n    df['df1'] * weights['df1'] +\n    df['df2'] * weights['df2'] +\n    df['df3'] * weights['df3'] +\n    df['df4'] * weights['df4']\n)\n\n# Keep only ID and final prediction\nsubmission = df[['ID', 'prediction']]\n\n# Save to CSV\nsubmission.to_csv('final_ensemble_submission.csv', index=False)","metadata":{"_uuid":"615888fd-c355-4b19-9015-ac7acb0f35b0","_cell_guid":"23a54e2f-678b-4bda-8ad1-c5d096dde924","trusted":true},"outputs":[],"execution_count":null}]}