{"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":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport glob\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\n\n'''\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n'''\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"execution":{"iopub.status.busy":"2021-09-15T08:22:36.615332Z","iopub.execute_input":"2021-09-15T08:22:36.615631Z","iopub.status.idle":"2021-09-15T08:22:36.626412Z","shell.execute_reply.started":"2021-09-15T08:22:36.615602Z","shell.execute_reply":"2021-09-15T08:22:36.625488Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub056 = pd.read_csv('../input/testsubmissions/submission (33).csv')\nsub084 = pd.read_csv('../input/testsubmissions/submission (34).csv')\nsub083 = pd.read_csv('../input/testsubmissions/submission (35).csv')\nsub077 = pd.read_csv('../input/testsubmissions/submission (36).csv').sort_values(by='BraTS21ID').reset_index().drop(columns=['index'])\nsub067mobnet = pd.read_csv('../input/testsubmissions/submission067mob.csv')\nsub067lstm = pd.read_csv('../input/testsubmissions/submissionlstm067.csv')\nsub074effnet74 = pd.read_csv('../input/testsubmissions/submission067mob.csv')\nsub0633dcnn = pd.read_csv('../input/testsubmissions/submissionlstm067.csv')","metadata":{"execution":{"iopub.status.busy":"2021-09-15T08:22:36.888316Z","iopub.execute_input":"2021-09-15T08:22:36.888641Z","iopub.status.idle":"2021-09-15T08:22:36.966874Z","shell.execute_reply.started":"2021-09-15T08:22:36.888606Z","shell.execute_reply":"2021-09-15T08:22:36.966068Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub056","metadata":{"execution":{"iopub.status.busy":"2021-09-15T08:22:37.173806Z","iopub.execute_input":"2021-09-15T08:22:37.174131Z","iopub.status.idle":"2021-09-15T08:22:37.193431Z","shell.execute_reply.started":"2021-09-15T08:22:37.174101Z","shell.execute_reply":"2021-09-15T08:22:37.192401Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub084","metadata":{"execution":{"iopub.status.busy":"2021-09-15T08:22:37.573461Z","iopub.execute_input":"2021-09-15T08:22:37.574183Z","iopub.status.idle":"2021-09-15T08:22:37.588591Z","shell.execute_reply.started":"2021-09-15T08:22:37.574146Z","shell.execute_reply":"2021-09-15T08:22:37.587521Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub083","metadata":{"execution":{"iopub.status.busy":"2021-09-15T08:22:38.074335Z","iopub.execute_input":"2021-09-15T08:22:38.075201Z","iopub.status.idle":"2021-09-15T08:22:38.08838Z","shell.execute_reply.started":"2021-09-15T08:22:38.075154Z","shell.execute_reply":"2021-09-15T08:22:38.087189Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub077","metadata":{"execution":{"iopub.status.busy":"2021-09-15T08:22:38.622059Z","iopub.execute_input":"2021-09-15T08:22:38.622354Z","iopub.status.idle":"2021-09-15T08:22:38.636097Z","shell.execute_reply.started":"2021-09-15T08:22:38.622326Z","shell.execute_reply":"2021-09-15T08:22:38.635037Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub067mobnet","metadata":{"execution":{"iopub.status.busy":"2021-09-15T08:22:39.131192Z","iopub.execute_input":"2021-09-15T08:22:39.131501Z","iopub.status.idle":"2021-09-15T08:22:39.14554Z","shell.execute_reply.started":"2021-09-15T08:22:39.131468Z","shell.execute_reply":"2021-09-15T08:22:39.144766Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub067lstm","metadata":{"execution":{"iopub.status.busy":"2021-09-15T08:22:40.152814Z","iopub.execute_input":"2021-09-15T08:22:40.153104Z","iopub.status.idle":"2021-09-15T08:22:40.167558Z","shell.execute_reply.started":"2021-09-15T08:22:40.153074Z","shell.execute_reply":"2021-09-15T08:22:40.166472Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub074effnet74","metadata":{"execution":{"iopub.status.busy":"2021-09-15T08:22:40.677873Z","iopub.execute_input":"2021-09-15T08:22:40.678149Z","iopub.status.idle":"2021-09-15T08:22:40.691938Z","shell.execute_reply.started":"2021-09-15T08:22:40.678122Z","shell.execute_reply":"2021-09-15T08:22:40.691005Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub0633dcnn","metadata":{"execution":{"iopub.status.busy":"2021-09-15T08:22:41.354584Z","iopub.execute_input":"2021-09-15T08:22:41.355378Z","iopub.status.idle":"2021-09-15T08:22:41.367974Z","shell.execute_reply.started":"2021-09-15T08:22:41.355334Z","shell.execute_reply":"2021-09-15T08:22:41.366804Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fsubmission = sub084.copy()\nfsubmission['MGMT_value'] = sub056['MGMT_value'].values*0.05 + sub084['MGMT_value'].values*0.4 + sub083['MGMT_value'].values*0.15 + \\\n        sub077['MGMT_value'].values*0.15 + sub067lstm['MGMT_value'].values*0.05 + sub067mobnet['MGMT_value'].values*0.05  + sub074effnet74['MGMT_value'].values*0.1 + sub0633dcnn['MGMT_value'].values*0.05","metadata":{"execution":{"iopub.status.busy":"2021-09-15T08:25:01.105471Z","iopub.execute_input":"2021-09-15T08:25:01.106385Z","iopub.status.idle":"2021-09-15T08:25:01.115859Z","shell.execute_reply.started":"2021-09-15T08:25:01.10632Z","shell.execute_reply":"2021-09-15T08:25:01.114787Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fsubmission['BraTS21ID'] = fsubmission['BraTS21ID'].apply(lambda x: str(x).zfill(5))","metadata":{"execution":{"iopub.status.busy":"2021-09-15T08:25:02.622697Z","iopub.execute_input":"2021-09-15T08:25:02.623097Z","iopub.status.idle":"2021-09-15T08:25:02.629664Z","shell.execute_reply.started":"2021-09-15T08:25:02.62306Z","shell.execute_reply":"2021-09-15T08:25:02.628488Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fsubmission","metadata":{"execution":{"iopub.status.busy":"2021-09-15T08:25:03.076852Z","iopub.execute_input":"2021-09-15T08:25:03.077192Z","iopub.status.idle":"2021-09-15T08:25:03.092758Z","shell.execute_reply.started":"2021-09-15T08:25:03.077161Z","shell.execute_reply":"2021-09-15T08:25:03.091965Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submissionDF01 = fsubmission.set_index('BraTS21ID')\nscoreDict01 = submissionDF01['MGMT_value'].to_dict()\nprint(scoreDict01)","metadata":{"execution":{"iopub.status.busy":"2021-09-15T07:47:02.426947Z","iopub.execute_input":"2021-09-15T07:47:02.42723Z","iopub.status.idle":"2021-09-15T07:47:02.434651Z","shell.execute_reply.started":"2021-09-15T07:47:02.427194Z","shell.execute_reply":"2021-09-15T07:47:02.433348Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"listOfStudyPaths = glob.glob('../input/rsna-miccai-brain-tumor-radiogenomic-classification/test/*')\nlistOfStudies = [eachPath.split('/')[-1] for eachPath in listOfStudyPaths]\n\npredList = []\nfor eachStudy in listOfStudies:\n    if eachStudy not in scoreDict01:\n        predList.append('0.500')\n    else:\n        score = float(scoreDict01[eachStudy])\n        predList.append(score)\n        \nsubmissionDF = pd.DataFrame({'BraTS21ID':listOfStudies,'MGMT_value':predList})\nsubmissionDF.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2021-09-15T07:47:03.583028Z","iopub.execute_input":"2021-09-15T07:47:03.583865Z","iopub.status.idle":"2021-09-15T07:47:03.606292Z","shell.execute_reply.started":"2021-09-15T07:47:03.583824Z","shell.execute_reply":"2021-09-15T07:47:03.605536Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submissionDF","metadata":{"execution":{"iopub.status.busy":"2021-09-15T07:47:04.337541Z","iopub.execute_input":"2021-09-15T07:47:04.338217Z","iopub.status.idle":"2021-09-15T07:47:04.350314Z","shell.execute_reply.started":"2021-09-15T07:47:04.338177Z","shell.execute_reply":"2021-09-15T07:47:04.349549Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}