{"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":116062,"databundleVersionId":14084779,"sourceType":"competition"},{"sourceId":270571028,"sourceType":"kernelVersion"},{"sourceId":269339911,"sourceType":"kernelVersion"}],"dockerImageVersionId":31153,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2025-10-24T18:09:27.720148Z","iopub.execute_input":"2025-10-24T18:09:27.720448Z","iopub.status.idle":"2025-10-24T18:09:28.047854Z","shell.execute_reply.started":"2025-10-24T18:09:27.720427Z","shell.execute_reply":"2025-10-24T18:09:28.046554Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"A = pd.read_csv('/kaggle/input/gaf-submission/submission.tsv',sep='\\t',header=None)\nA['pred_key'] = [f'{pt}_{go}' for pt,go in zip(A[0],A[1])]\nA.tail()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-24T18:09:28.049274Z","iopub.execute_input":"2025-10-24T18:09:28.049736Z","iopub.status.idle":"2025-10-24T18:09:30.833009Z","shell.execute_reply.started":"2025-10-24T18:09:28.049711Z","shell.execute_reply":"2025-10-24T18:09:30.832097Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"B = pd.read_csv('/kaggle/input/merge-of-2submission-lb-0-25/submission.tsv',sep='\\t',header=None)\nB['pred_key'] = [f'{pt}_{go}' for pt,go in zip(B[0],B[1])]\nB.tail()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-24T18:09:30.833927Z","iopub.execute_input":"2025-10-24T18:09:30.834151Z","iopub.status.idle":"2025-10-24T18:10:40.505258Z","shell.execute_reply.started":"2025-10-24T18:09:30.834133Z","shell.execute_reply":"2025-10-24T18:10:40.503981Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"common_in_A = A[A['pred_key'].isin(B['pred_key'])].sort_values('pred_key').reset_index(drop=True)\ncommon_in_A.tail()","metadata":{"trusted":true,"execution":{"execution_failed":"2025-10-24T18:10:58.296Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"common_in_B = B[B['pred_key'].isin(A['pred_key'])].sort_values('pred_key').reset_index(drop=True)\ncommon_in_B.tail()","metadata":{"trusted":true,"execution":{"execution_failed":"2025-10-24T18:10:58.297Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"common_ensemble = common_in_A.copy()\ncommon_ensemble[2] = (common_in_A[2] + common_in_B[2]) / 2","metadata":{"trusted":true,"execution":{"execution_failed":"2025-10-24T18:10:58.297Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"not_common_in_A = A[~A['pred_key'].isin(B['pred_key'])].sort_values('pred_key').reset_index(drop=True)\nnot_common_in_A.tail()","metadata":{"trusted":true,"execution":{"execution_failed":"2025-10-24T18:10:58.297Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"not_common_in_B = B[~B['pred_key'].isin(A['pred_key'])].sort_values('pred_key').reset_index(drop=True)\nnot_common_in_B.tail()","metadata":{"trusted":true,"execution":{"execution_failed":"2025-10-24T18:10:58.297Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"pd.concat([\n    common_ensemble,\n    not_common_in_A,\n    not_common_in_B\n])[[0,1,2]].to_csv('submission.tsv',sep='\\t',index=False,header=None)","metadata":{"trusted":true,"execution":{"execution_failed":"2025-10-24T18:10:58.297Z"}},"outputs":[],"execution_count":null}]}