{"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":"## Imports\nimport random\nimport numpy\nimport matplotlib.pyplot as plt\nimport pandas as pd\nimport seaborn as sns\n\nrandom.seed(42)","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-10-07T04:12:06.41037Z","iopub.execute_input":"2023-10-07T04:12:06.411122Z","iopub.status.idle":"2023-10-07T04:12:08.213191Z","shell.execute_reply.started":"2023-10-07T04:12:06.41108Z","shell.execute_reply":"2023-10-07T04:12:08.212079Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"## Read data\ntrain_df = pd.read_csv(\"/kaggle/input/UBC-OCEAN/train.csv\")\ntest_df = pd.read_csv(\"/kaggle/input/UBC-OCEAN/test.csv\")\ntrain_images_path = \"/kaggle/input/UBC-OCEAN/train_images\"\ntest_images_path = \"/kaggle/input/UBC-OCEAN/test_images\"\ntrain_thumbnails_path = \"/kaggle/input/UBC-OCEAN/train_thumbnails\"\ntest_thumbnails_path = \"/kaggle/input/UBC-OCEAN/test_thumbnails\"\n\nprint(\"Train dataframe\", train_df.shape)\nprint(\"Test dataframe\", test_df.shape)\ntrain_df.sample(10)","metadata":{"execution":{"iopub.status.busy":"2023-10-07T04:12:08.215063Z","iopub.execute_input":"2023-10-07T04:12:08.215555Z","iopub.status.idle":"2023-10-07T04:12:08.267095Z","shell.execute_reply.started":"2023-10-07T04:12:08.215527Z","shell.execute_reply":"2023-10-07T04:12:08.266206Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### How many images?","metadata":{}},{"cell_type":"code","source":"train_df.image_id.nunique()","metadata":{"execution":{"iopub.status.busy":"2023-10-07T03:30:20.153287Z","iopub.execute_input":"2023-10-07T03:30:20.154151Z","iopub.status.idle":"2023-10-07T03:30:20.163666Z","shell.execute_reply.started":"2023-10-07T03:30:20.154124Z","shell.execute_reply":"2023-10-07T03:30:20.162803Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### How many labels are present?\n\nThese are the five types of ovarian cancer:\n- high-grade serous carcinoma (Highes count in dataset)\n- clear-cell ovarian carcinoma\n- endometrioid\n- low-grade serous\n- mucinous carcinoma","metadata":{}},{"cell_type":"code","source":"plt.title(\"Distribution of Labels\")\nsns.countplot(train_df, x=\"label\");","metadata":{"execution":{"iopub.status.busy":"2023-10-07T03:43:26.310053Z","iopub.execute_input":"2023-10-07T03:43:26.310989Z","iopub.status.idle":"2023-10-07T03:43:26.541817Z","shell.execute_reply.started":"2023-10-07T03:43:26.310959Z","shell.execute_reply":"2023-10-07T03:43:26.540802Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### How many slides are tissues micro array?","metadata":{}},{"cell_type":"code","source":"plt.title(\"Distribution of micro array tissues\")\nsns.countplot(train_df, x=\"is_tma\", hue=\"label\");","metadata":{"execution":{"iopub.status.busy":"2023-10-07T04:12:17.204287Z","iopub.execute_input":"2023-10-07T04:12:17.204632Z","iopub.status.idle":"2023-10-07T04:12:17.53456Z","shell.execute_reply.started":"2023-10-07T04:12:17.204606Z","shell.execute_reply":"2023-10-07T04:12:17.533471Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-10-07T03:51:04.728654Z","iopub.execute_input":"2023-10-07T03:51:04.729537Z","iopub.status.idle":"2023-10-07T03:51:04.748188Z","shell.execute_reply.started":"2023-10-07T03:51:04.7295Z","shell.execute_reply":"2023-10-07T03:51:04.747399Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Summary of image sizes","metadata":{}},{"cell_type":"code","source":"plt.figure(figsize=(15,3))\nplt.subplot(1,2,1)\nsns.boxplot(train_df, x=\"image_width\")\nplt.subplot(1,2,2)\nsns.boxplot(train_df, x=\"image_height\");","metadata":{"execution":{"iopub.status.busy":"2023-10-07T03:53:00.782427Z","iopub.execute_input":"2023-10-07T03:53:00.783034Z","iopub.status.idle":"2023-10-07T03:53:00.979661Z","shell.execute_reply.started":"2023-10-07T03:53:00.783005Z","shell.execute_reply":"2023-10-07T03:53:00.978678Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Lets look at some images","metadata":{}},{"cell_type":"code","source":"random_rows = train_df.sample(5)\ncount = 1\nplt.figure(figsize=(20,15))\nfor row in random_rows.itertuples():\n    plt.subplot(1, 5, count)\n    image = plt.imread(f\"{train_thumbnails_path}/{row.image_id}_thumbnail.png\")\n    plt.imshow(image)\n    plt.title(row.label)\n    count += 1","metadata":{"execution":{"iopub.status.busy":"2023-10-07T04:18:01.373758Z","iopub.execute_input":"2023-10-07T04:18:01.374194Z","iopub.status.idle":"2023-10-07T04:18:09.376394Z","shell.execute_reply.started":"2023-10-07T04:18:01.374125Z","shell.execute_reply":"2023-10-07T04:18:09.375571Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Kindly upvote!!","metadata":{}}]}