{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.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":71549,"databundleVersionId":8561470,"sourceType":"competition"}],"dockerImageVersionId":30698,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport os\nimport time\n\n# plots\nimport matplotlib.pyplot as plt\nimport plotly.express as px\nimport seaborn as sns\n\n# dicom\nimport pydicom as dicom","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-05-30T03:31:18.879580Z","iopub.execute_input":"2024-05-30T03:31:18.879881Z","iopub.status.idle":"2024-05-30T03:31:21.380342Z","shell.execute_reply.started":"2024-05-30T03:31:18.879856Z","shell.execute_reply":"2024-05-30T03:31:21.379242Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# warning handling\nimport warnings\nwarnings.filterwarnings('ignore')","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:31:35.029179Z","iopub.execute_input":"2024-05-30T03:31:35.029747Z","iopub.status.idle":"2024-05-30T03:31:35.034420Z","shell.execute_reply.started":"2024-05-30T03:31:35.029714Z","shell.execute_reply":"2024-05-30T03:31:35.033351Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# show files\n!ls -l '../input/rsna-2024-lumbar-spine-degenerative-classification'","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:31:46.835272Z","iopub.execute_input":"2024-05-30T03:31:46.835625Z","iopub.status.idle":"2024-05-30T03:31:47.846734Z","shell.execute_reply.started":"2024-05-30T03:31:46.835598Z","shell.execute_reply":"2024-05-30T03:31:47.845680Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# configs\ndefault_color_1 = 'orange'","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:36:42.801287Z","iopub.execute_input":"2024-05-30T03:36:42.801684Z","iopub.status.idle":"2024-05-30T03:36:42.806154Z","shell.execute_reply.started":"2024-05-30T03:36:42.801650Z","shell.execute_reply":"2024-05-30T03:36:42.805073Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# read data\ndf_train_main = pd.read_csv('../input/rsna-2024-lumbar-spine-degenerative-classification/train.csv')\ndf_train_label = pd.read_csv('../input/rsna-2024-lumbar-spine-degenerative-classification/train_label_coordinates.csv')\ndf_train_desc = pd.read_csv('../input/rsna-2024-lumbar-spine-degenerative-classification/train_series_descriptions.csv')\ndf_test_desc = pd.read_csv('../input/rsna-2024-lumbar-spine-degenerative-classification/test_series_descriptions.csv')\ndf_sub = pd.read_csv('../input/rsna-2024-lumbar-spine-degenerative-classification/sample_submission.csv')","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:36:45.939063Z","iopub.execute_input":"2024-05-30T03:36:45.939738Z","iopub.status.idle":"2024-05-30T03:36:46.038685Z","shell.execute_reply.started":"2024-05-30T03:36:45.939705Z","shell.execute_reply":"2024-05-30T03:36:46.037866Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Data Preparation\n\nMain Table","metadata":{}},{"cell_type":"code","source":"# structure\ndf_train_main.info()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:36:48.928553Z","iopub.execute_input":"2024-05-30T03:36:48.929517Z","iopub.status.idle":"2024-05-30T03:36:48.942443Z","shell.execute_reply.started":"2024-05-30T03:36:48.929481Z","shell.execute_reply":"2024-05-30T03:36:48.941429Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# preview\ndf_train_main.head()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:36:52.089979Z","iopub.execute_input":"2024-05-30T03:36:52.090338Z","iopub.status.idle":"2024-05-30T03:36:52.110325Z","shell.execute_reply.started":"2024-05-30T03:36:52.090309Z","shell.execute_reply":"2024-05-30T03:36:52.109358Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Label","metadata":{}},{"cell_type":"code","source":"# structure\ndf_train_label.info()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:36:54.569412Z","iopub.execute_input":"2024-05-30T03:36:54.570329Z","iopub.status.idle":"2024-05-30T03:36:54.585001Z","shell.execute_reply.started":"2024-05-30T03:36:54.570295Z","shell.execute_reply":"2024-05-30T03:36:54.583958Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# preview\ndf_train_label.head()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:36:56.682040Z","iopub.execute_input":"2024-05-30T03:36:56.682400Z","iopub.status.idle":"2024-05-30T03:36:56.694522Z","shell.execute_reply.started":"2024-05-30T03:36:56.682372Z","shell.execute_reply":"2024-05-30T03:36:56.693317Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# look at categories\nfor f in ['instance_number','condition','level']:\n    print(df_train_label[f].value_counts())\n    print()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:36:59.636090Z","iopub.execute_input":"2024-05-30T03:36:59.636456Z","iopub.status.idle":"2024-05-30T03:36:59.650557Z","shell.execute_reply.started":"2024-05-30T03:36:59.636428Z","shell.execute_reply":"2024-05-30T03:36:59.649608Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# numerical plot for instance number\nplt.figure(figsize=(7,1))\ndf_train_label.instance_number.plot(kind='box', vert=False)\nplt.grid()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:37:02.317236Z","iopub.execute_input":"2024-05-30T03:37:02.317658Z","iopub.status.idle":"2024-05-30T03:37:02.482482Z","shell.execute_reply.started":"2024-05-30T03:37:02.317615Z","shell.execute_reply":"2024-05-30T03:37:02.481685Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# look at few rows with the very high instance numbers\ndf_train_label[df_train_label.instance_number>150]","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:37:04.841988Z","iopub.execute_input":"2024-05-30T03:37:04.842791Z","iopub.status.idle":"2024-05-30T03:37:04.859145Z","shell.execute_reply.started":"2024-05-30T03:37:04.842758Z","shell.execute_reply":"2024-05-30T03:37:04.858122Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# condition vs level\npd.crosstab(df_train_label.condition, df_train_label.level)","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:37:07.302922Z","iopub.execute_input":"2024-05-30T03:37:07.303292Z","iopub.status.idle":"2024-05-30T03:37:07.329971Z","shell.execute_reply.started":"2024-05-30T03:37:07.303265Z","shell.execute_reply":"2024-05-30T03:37:07.329017Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# structure\ndf_train_desc.info()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:37:09.890364Z","iopub.execute_input":"2024-05-30T03:37:09.890755Z","iopub.status.idle":"2024-05-30T03:37:09.902819Z","shell.execute_reply.started":"2024-05-30T03:37:09.890722Z","shell.execute_reply":"2024-05-30T03:37:09.901669Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# preview\ndf_train_desc.head()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:37:12.393686Z","iopub.execute_input":"2024-05-30T03:37:12.394084Z","iopub.status.idle":"2024-05-30T03:37:12.404263Z","shell.execute_reply.started":"2024-05-30T03:37:12.394050Z","shell.execute_reply":"2024-05-30T03:37:12.403196Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# look at categories\ncounts = df_train_desc.series_description.value_counts()\nprint(counts)\nplt.figure(figsize=(7,3))\ncounts.plot(kind='bar', color=default_color_1)\nplt.grid()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:37:14.842807Z","iopub.execute_input":"2024-05-30T03:37:14.843210Z","iopub.status.idle":"2024-05-30T03:37:14.982090Z","shell.execute_reply.started":"2024-05-30T03:37:14.843179Z","shell.execute_reply":"2024-05-30T03:37:14.981059Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# join first two tables\ndf_train_step_1 = pd.merge(left=df_train_label, right=df_train_main, how='left', on='study_id').reset_index(drop=True)\ndf_train_step_1.head()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:37:31.046615Z","iopub.execute_input":"2024-05-30T03:37:31.046995Z","iopub.status.idle":"2024-05-30T03:37:31.174084Z","shell.execute_reply.started":"2024-05-30T03:37:31.046963Z","shell.execute_reply":"2024-05-30T03:37:31.173356Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# join with third table\ndf_train = pd.merge(left=df_train_step_1, right=df_train_desc, how='left', on=['study_id', 'series_id']).reset_index(drop=True)\ndf_train.head()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:37:43.594441Z","iopub.execute_input":"2024-05-30T03:37:43.594801Z","iopub.status.idle":"2024-05-30T03:37:43.702251Z","shell.execute_reply.started":"2024-05-30T03:37:43.594773Z","shell.execute_reply":"2024-05-30T03:37:43.701133Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# convert ids to categorical\ndf_train.study_id = df_train.study_id.astype('category')\ndf_train.series_id = df_train.series_id.astype('category')","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:37:56.199449Z","iopub.execute_input":"2024-05-30T03:37:56.200569Z","iopub.status.idle":"2024-05-30T03:37:56.207222Z","shell.execute_reply.started":"2024-05-30T03:37:56.200525Z","shell.execute_reply":"2024-05-30T03:37:56.206171Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# EDA","metadata":{}},{"cell_type":"code","source":"# combined table - basic stats\ndf_train.describe(include='all').T","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:38:40.551597Z","iopub.execute_input":"2024-05-30T03:38:40.551993Z","iopub.status.idle":"2024-05-30T03:38:40.746951Z","shell.execute_reply.started":"2024-05-30T03:38:40.551961Z","shell.execute_reply":"2024-05-30T03:38:40.745960Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# plot coordinates\nsns.jointplot(data=df_train, x='x', y='y', \n              color=default_color_1, alpha=0.25)\nplt.grid()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:39:12.528320Z","iopub.execute_input":"2024-05-30T03:39:12.528666Z","iopub.status.idle":"2024-05-30T03:39:13.627555Z","shell.execute_reply.started":"2024-05-30T03:39:12.528639Z","shell.execute_reply":"2024-05-30T03:39:13.626607Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# plot coordinates - colored by condition\nax = sns.jointplot(data=df_train, x='x', y='y', \n                   hue='condition', alpha=0.25)\nplt.legend(bbox_to_anchor=(1.2,1), loc=2)\nplt.grid()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:39:27.032634Z","iopub.execute_input":"2024-05-30T03:39:27.033042Z","iopub.status.idle":"2024-05-30T03:39:29.772276Z","shell.execute_reply.started":"2024-05-30T03:39:27.032995Z","shell.execute_reply":"2024-05-30T03:39:29.771267Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# plot coordinates - colored by level\nsns.jointplot(data=df_train, x='x', y='y', \n              hue='level', alpha=0.25)\nplt.legend(bbox_to_anchor=(1.2,1), loc=2)\nplt.grid()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:40:19.784196Z","iopub.execute_input":"2024-05-30T03:40:19.785278Z","iopub.status.idle":"2024-05-30T03:40:22.440141Z","shell.execute_reply.started":"2024-05-30T03:40:19.785240Z","shell.execute_reply":"2024-05-30T03:40:22.439141Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# plot coordinates - colored by description\nsns.jointplot(data=df_train, x='x', y='y', \n              hue='series_description', alpha=0.25)\nplt.legend(bbox_to_anchor=(1.2,1), loc=2)\nplt.grid()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:40:39.346051Z","iopub.execute_input":"2024-05-30T03:40:39.346787Z","iopub.status.idle":"2024-05-30T03:40:42.066657Z","shell.execute_reply.started":"2024-05-30T03:40:39.346749Z","shell.execute_reply":"2024-05-30T03:40:42.065602Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Distributing Label data","metadata":{}},{"cell_type":"code","source":"labels = df_train_main.columns.drop('study_id').tolist()\nprint(labels)","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:40:56.306228Z","iopub.execute_input":"2024-05-30T03:40:56.306588Z","iopub.status.idle":"2024-05-30T03:40:56.312053Z","shell.execute_reply.started":"2024-05-30T03:40:56.306561Z","shell.execute_reply":"2024-05-30T03:40:56.311247Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# plot label distributions\nfor l in labels:\n    plt.figure(figsize=(6,2))\n    counts = df_train_main[l].value_counts(normalize=True)\n    print(counts)\n    counts.plot(kind='bar', color=default_color_1)\n    plt.grid()\n    plt.show()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:41:54.875215Z","iopub.execute_input":"2024-05-30T03:41:54.875995Z","iopub.status.idle":"2024-05-30T03:41:58.881271Z","shell.execute_reply.started":"2024-05-30T03:41:54.875966Z","shell.execute_reply":"2024-05-30T03:41:58.880222Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# create frequency table for the labels\nfreqs = pd.DataFrame(labels, columns=['label'])\nfreqs['p1'] = 1.0\nfreqs['p2'] = 0.0\nfreqs['p3'] = 0.0\n\nfor l in labels:\n    rel_counts = df_train_main[l].value_counts(normalize=True)\n    freqs.loc[freqs.label==l, 'p1'] = rel_counts['Normal/Mild']\n    freqs.loc[freqs.label==l, 'p2'] = rel_counts['Moderate']\n    freqs.loc[freqs.label==l, 'p3'] = rel_counts['Severe']","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:42:15.047674Z","iopub.execute_input":"2024-05-30T03:42:15.048623Z","iopub.status.idle":"2024-05-30T03:42:15.107853Z","shell.execute_reply.started":"2024-05-30T03:42:15.048589Z","shell.execute_reply":"2024-05-30T03:42:15.107096Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# show frequency table\nfreqs","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:42:24.958025Z","iopub.execute_input":"2024-05-30T03:42:24.958390Z","iopub.status.idle":"2024-05-30T03:42:24.971897Z","shell.execute_reply.started":"2024-05-30T03:42:24.958363Z","shell.execute_reply":"2024-05-30T03:42:24.970925Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# make combined table available for download\ndf_train.to_csv('df_train.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:42:33.907577Z","iopub.execute_input":"2024-05-30T03:42:33.908482Z","iopub.status.idle":"2024-05-30T03:42:34.724995Z","shell.execute_reply.started":"2024-05-30T03:42:33.908447Z","shell.execute_reply":"2024-05-30T03:42:34.723941Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"my_study = 4003253\ndf_ex = df_train[df_train.study_id==my_study]\ndf_ex","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:42:44.861267Z","iopub.execute_input":"2024-05-30T03:42:44.862220Z","iopub.status.idle":"2024-05-30T03:42:44.893172Z","shell.execute_reply.started":"2024-05-30T03:42:44.862179Z","shell.execute_reply":"2024-05-30T03:42:44.892440Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"my_series = 702807833\ndf_ex1 = df_ex[df_ex.series_id==my_series]\ndf_ex1","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:42:58.509203Z","iopub.execute_input":"2024-05-30T03:42:58.509597Z","iopub.status.idle":"2024-05-30T03:42:58.534035Z","shell.execute_reply.started":"2024-05-30T03:42:58.509556Z","shell.execute_reply":"2024-05-30T03:42:58.532940Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# create file path and show files\nmy_path = '../input/rsna-2024-lumbar-spine-degenerative-classification/train_images/' + str(my_study) + '/' + str(my_series) + '/'\nfor dirname, _, filenames in os.walk(my_path):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:43:16.759653Z","iopub.execute_input":"2024-05-30T03:43:16.760425Z","iopub.status.idle":"2024-05-30T03:43:16.774791Z","shell.execute_reply.started":"2024-05-30T03:43:16.760386Z","shell.execute_reply":"2024-05-30T03:43:16.774124Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for i in range(1,15+1):\n    my_file = my_path + str(i) + '.dcm'\n    print(my_file)\n    # load image\n    ds = dicom.dcmread(my_file)\n    # and plot\n    plt.imshow(ds.pixel_array)\n    plt.show()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:43:26.991587Z","iopub.execute_input":"2024-05-30T03:43:26.992675Z","iopub.status.idle":"2024-05-30T03:43:31.039229Z","shell.execute_reply.started":"2024-05-30T03:43:26.992632Z","shell.execute_reply":"2024-05-30T03:43:31.038186Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# preview test data\ndf_test_desc.head()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:43:52.741687Z","iopub.execute_input":"2024-05-30T03:43:52.742812Z","iopub.status.idle":"2024-05-30T03:43:52.751959Z","shell.execute_reply.started":"2024-05-30T03:43:52.742768Z","shell.execute_reply":"2024-05-30T03:43:52.751247Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# preview sample submission\ndf_sub.head()","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:44:03.981804Z","iopub.execute_input":"2024-05-30T03:44:03.982486Z","iopub.status.idle":"2024-05-30T03:44:03.993767Z","shell.execute_reply.started":"2024-05-30T03:44:03.982449Z","shell.execute_reply":"2024-05-30T03:44:03.992734Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# setup baseline model just using observed frequencies\nn = df_sub.shape[0]\nfor i in range(0,n):\n    # extract label from id\n    current_label = df_sub.loc[i, 'row_id'].split('_',1)[1]\n    # look up frequencies in frequency table\n    p1 = freqs.loc[freqs.label==current_label, 'p1'].min()\n    p2 = freqs.loc[freqs.label==current_label, 'p2'].min()\n    p3 = freqs.loc[freqs.label==current_label, 'p3'].min()\n    # transfer results to submission table\n    df_sub.loc[i, 'normal_mild'] = p1\n    df_sub.loc[i, 'moderate'] = p2\n    df_sub.loc[i, 'severe'] = p3","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:44:14.775564Z","iopub.execute_input":"2024-05-30T03:44:14.776480Z","iopub.status.idle":"2024-05-30T03:44:14.837828Z","shell.execute_reply.started":"2024-05-30T03:44:14.776443Z","shell.execute_reply":"2024-05-30T03:44:14.836912Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# preview\ndf_sub","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:44:25.333789Z","iopub.execute_input":"2024-05-30T03:44:25.334706Z","iopub.status.idle":"2024-05-30T03:44:25.347808Z","shell.execute_reply.started":"2024-05-30T03:44:25.334669Z","shell.execute_reply":"2024-05-30T03:44:25.346735Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# save submission file\ndf_sub.to_csv('submission_freq.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:44:42.945291Z","iopub.execute_input":"2024-05-30T03:44:42.945979Z","iopub.status.idle":"2024-05-30T03:44:42.951934Z","shell.execute_reply.started":"2024-05-30T03:44:42.945944Z","shell.execute_reply":"2024-05-30T03:44:42.950744Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# simple version, just fixed values\nn = df_sub.shape[0]\nfor i in range(0,n):\n    df_sub.loc[i, 'normal_mild'] = 0.34\n    df_sub.loc[i, 'moderate'] = 0.33\n    df_sub.loc[i, 'severe'] = 0.33","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:44:52.983856Z","iopub.execute_input":"2024-05-30T03:44:52.984261Z","iopub.status.idle":"2024-05-30T03:44:53.011230Z","shell.execute_reply.started":"2024-05-30T03:44:52.984231Z","shell.execute_reply":"2024-05-30T03:44:53.010015Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# save submission file\ndf_sub.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2024-05-30T03:45:02.502329Z","iopub.execute_input":"2024-05-30T03:45:02.502723Z","iopub.status.idle":"2024-05-30T03:45:02.509249Z","shell.execute_reply.started":"2024-05-30T03:45:02.502690Z","shell.execute_reply":"2024-05-30T03:45:02.508307Z"},"trusted":true},"execution_count":null,"outputs":[]}]}