{"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":"import numpy as np \nimport pandas as pd \nimport glob\nimport os\nimport matplotlib.pyplot as plt\nimport plotly.figure_factory as ff\nimport plotly.express as px\n\nimport plotly.graph_objects as go\nfrom plotly.offline import iplot","metadata":{"papermill":{"duration":3.263001,"end_time":"2021-09-22T07:34:29.988255","exception":false,"start_time":"2021-09-22T07:34:26.725254","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-09-27T06:17:13.278744Z","iopub.execute_input":"2021-09-27T06:17:13.279697Z","iopub.status.idle":"2021-09-27T06:17:13.285977Z","shell.execute_reply.started":"2021-09-27T06:17:13.279648Z","shell.execute_reply":"2021-09-27T06:17:13.285332Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub_715 = pd.read_csv('../input/brain-tumor-3d-blender-csv/RSNA_Public/715.csv')\nsub_684 = pd.read_csv('../input/brain-tumor-3d-blender-csv/RSNA_Public/684.csv')\nsub_683 = pd.read_csv('../input/brain-tumor-3d-blender-csv/RSNA_Public/683.csv')\nsub_674 = pd.read_csv('../input/brain-tumor-3d-blender-csv/RSNA_Public/674.csv')","metadata":{"papermill":{"duration":0.078095,"end_time":"2021-09-22T07:34:30.079307","exception":false,"start_time":"2021-09-22T07:34:30.001212","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-09-27T06:17:13.287142Z","iopub.execute_input":"2021-09-27T06:17:13.287914Z","iopub.status.idle":"2021-09-27T06:17:13.32433Z","shell.execute_reply.started":"2021-09-27T06:17:13.287875Z","shell.execute_reply":"2021-09-27T06:17:13.32348Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub_715=sub_715.sort_values(by=['BraTS21ID'], ascending=True)\nsub_715=sub_715.reset_index(drop=True)\nsub_715.head(3)","metadata":{"papermill":{"duration":0.040047,"end_time":"2021-09-22T07:34:30.1323","exception":false,"start_time":"2021-09-22T07:34:30.092253","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-09-27T06:17:14.234572Z","iopub.execute_input":"2021-09-27T06:17:14.234863Z","iopub.status.idle":"2021-09-27T06:17:14.248856Z","shell.execute_reply.started":"2021-09-27T06:17:14.234831Z","shell.execute_reply":"2021-09-27T06:17:14.248023Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub_684=sub_684.sort_values(by=['BraTS21ID'], ascending=True)\nsub_684=sub_684.reset_index(drop=True)\nsub_684.head(3)","metadata":{"papermill":{"duration":0.023463,"end_time":"2021-09-22T07:34:30.169162","exception":false,"start_time":"2021-09-22T07:34:30.145699","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-09-27T06:17:14.25057Z","iopub.execute_input":"2021-09-27T06:17:14.251225Z","iopub.status.idle":"2021-09-27T06:17:14.260557Z","shell.execute_reply.started":"2021-09-27T06:17:14.251196Z","shell.execute_reply":"2021-09-27T06:17:14.259621Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub_683=sub_683.sort_values(by=['BraTS21ID'], ascending=True)\nsub_683=sub_683.reset_index(drop=True)\nsub_683.head(3)","metadata":{"papermill":{"duration":0.028383,"end_time":"2021-09-22T07:34:30.211198","exception":false,"start_time":"2021-09-22T07:34:30.182815","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-09-27T06:17:14.26154Z","iopub.execute_input":"2021-09-27T06:17:14.261771Z","iopub.status.idle":"2021-09-27T06:17:14.272469Z","shell.execute_reply.started":"2021-09-27T06:17:14.261728Z","shell.execute_reply":"2021-09-27T06:17:14.271525Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub_674=sub_674.sort_values(by=['BraTS21ID'], ascending=True)\nsub_674=sub_674.reset_index(drop=True)\nsub_674.head(3)","metadata":{"papermill":{"duration":0.024928,"end_time":"2021-09-22T07:34:30.25003","exception":false,"start_time":"2021-09-22T07:34:30.225102","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-09-27T06:17:14.273839Z","iopub.execute_input":"2021-09-27T06:17:14.274421Z","iopub.status.idle":"2021-09-27T06:17:14.285122Z","shell.execute_reply.started":"2021-09-27T06:17:14.274388Z","shell.execute_reply":"2021-09-27T06:17:14.284364Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dfs = {\"sub_715\" : sub_715, \"sub_684\": sub_684, \"sub_683\" : sub_683, \"sub_674\" : sub_674}","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Finalsubmission = sub_715.copy()\nFinalsubmission['MGMT_value'] =\\\nsub_715['MGMT_value'].values*0.604+\\\nsub_684['MGMT_value'].values*0.185+\\\nsub_683['MGMT_value'].values*0.105+\\\nsub_674['MGMT_value'].values*0.106","metadata":{"papermill":{"duration":0.029834,"end_time":"2021-09-22T07:34:31.397379","exception":false,"start_time":"2021-09-22T07:34:31.367545","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-09-27T06:17:15.018559Z","iopub.execute_input":"2021-09-27T06:17:15.018917Z","iopub.status.idle":"2021-09-27T06:17:15.025288Z","shell.execute_reply.started":"2021-09-27T06:17:15.018886Z","shell.execute_reply":"2021-09-27T06:17:15.024292Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Finalsubmission['BraTS21ID'] = Finalsubmission['BraTS21ID'].apply(lambda x: str(x).zfill(5))","metadata":{"papermill":{"duration":0.025142,"end_time":"2021-09-22T07:34:31.439804","exception":false,"start_time":"2021-09-22T07:34:31.414662","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-09-27T06:17:15.02727Z","iopub.execute_input":"2021-09-27T06:17:15.027517Z","iopub.status.idle":"2021-09-27T06:17:15.039054Z","shell.execute_reply.started":"2021-09-27T06:17:15.027488Z","shell.execute_reply":"2021-09-27T06:17:15.03835Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Fsubmission = Finalsubmission.set_index('BraTS21ID')\nFsubmissionDict = Fsubmission['MGMT_value'].to_dict()","metadata":{"papermill":{"duration":0.024567,"end_time":"2021-09-22T07:34:31.526963","exception":false,"start_time":"2021-09-22T07:34:31.502396","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-09-27T06:17:15.059493Z","iopub.execute_input":"2021-09-27T06:17:15.059868Z","iopub.status.idle":"2021-09-27T06:17:15.069046Z","shell.execute_reply.started":"2021-09-27T06:17:15.059822Z","shell.execute_reply":"2021-09-27T06:17:15.068202Z"},"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 FsubmissionDict:\n        predList.append('0.500')\n    else:\n        score = float(FsubmissionDict[eachStudy])\n        predList.append(score)\n        \nsubmission = pd.DataFrame({'BraTS21ID':listOfStudies,'MGMT_value':predList})\n","metadata":{"papermill":{"duration":0.044541,"end_time":"2021-09-22T07:34:31.588226","exception":false,"start_time":"2021-09-22T07:34:31.543685","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-09-27T06:17:15.96176Z","iopub.execute_input":"2021-09-27T06:17:15.962242Z","iopub.status.idle":"2021-09-27T06:17:15.975116Z","shell.execute_reply.started":"2021-09-27T06:17:15.962212Z","shell.execute_reply":"2021-09-27T06:17:15.973352Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission=submission.sort_values(by=['BraTS21ID'], ascending=True)\nsubmission=submission.reset_index(drop=True)\nsubmission.head(5)","metadata":{"papermill":{"duration":0.030703,"end_time":"2021-09-22T07:34:31.636441","exception":false,"start_time":"2021-09-22T07:34:31.605738","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-09-27T06:17:15.977777Z","iopub.execute_input":"2021-09-27T06:17:15.978124Z","iopub.status.idle":"2021-09-27T06:17:15.992994Z","shell.execute_reply.started":"2021-09-27T06:17:15.978082Z","shell.execute_reply":"2021-09-27T06:17:15.991941Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.to_csv('submission.csv', index=False)","metadata":{"papermill":{"duration":0.029576,"end_time":"2021-09-22T07:34:31.693239","exception":false,"start_time":"2021-09-22T07:34:31.663663","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2021-09-27T06:17:15.994625Z","iopub.execute_input":"2021-09-27T06:17:15.995019Z","iopub.status.idle":"2021-09-27T06:17:16.006451Z","shell.execute_reply.started":"2021-09-27T06:17:15.994975Z","shell.execute_reply":"2021-09-27T06:17:16.0056Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Please if this kernel is useful, <font color='red'>please upvote !!</font>","metadata":{}}]}