{"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 pandas as pd\nimport matplotlib.pyplot as plt\nfrom skimage import io","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-10-06T18:24:15.656163Z","iopub.execute_input":"2023-10-06T18:24:15.656552Z","iopub.status.idle":"2023-10-06T18:24:15.661217Z","shell.execute_reply.started":"2023-10-06T18:24:15.656523Z","shell.execute_reply":"2023-10-06T18:24:15.66037Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Load train data\ntrain_df = pd.read_csv('/kaggle/input/UBC-OCEAN/train.csv')\nprint(train_df.shape)\ntrain_df.head(2)","metadata":{"execution":{"iopub.status.busy":"2023-10-06T18:29:34.879719Z","iopub.execute_input":"2023-10-06T18:29:34.88011Z","iopub.status.idle":"2023-10-06T18:29:34.898426Z","shell.execute_reply.started":"2023-10-06T18:29:34.880065Z","shell.execute_reply":"2023-10-06T18:29:34.896958Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Check for unique/repeated values \nprint(train_df.image_id.is_unique)\nprint(train_df.label.is_unique)","metadata":{"execution":{"iopub.status.busy":"2023-10-06T17:56:20.841047Z","iopub.execute_input":"2023-10-06T17:56:20.841467Z","iopub.status.idle":"2023-10-06T17:56:20.847763Z","shell.execute_reply.started":"2023-10-06T17:56:20.841435Z","shell.execute_reply":"2023-10-06T17:56:20.846689Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Check for labels \ntrain_df.label.value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-10-06T17:57:05.815799Z","iopub.execute_input":"2023-10-06T17:57:05.816241Z","iopub.status.idle":"2023-10-06T17:57:05.827772Z","shell.execute_reply.started":"2023-10-06T17:57:05.816207Z","shell.execute_reply":"2023-10-06T17:57:05.826643Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"GPT Generated!\n\nHGSC - High-Grade Serous Carcinoma: This is the most common and aggressive type of ovarian cancer. It is characterized by its high-grade appearance under a microscope and is often associated with genetic mutations, such as BRCA1 and BRCA2.\n\nLGSC - Low-Grade Serous Carcinoma: This is a less common subtype of ovarian cancer, and it tends to grow more slowly and have a better prognosis compared to high-grade serous carcinoma.\n\nEC - Endometrioid Carcinoma: Endometrioid carcinoma is a type of ovarian cancer that resembles the tissue of the uterine lining (endometrium). It is often associated with endometriosis and can have a somewhat better prognosis than high-grade serous carcinoma.\n\nCC - Clear Cell Carcinoma: Clear cell carcinoma is another subtype of ovarian cancer. It is characterized by the clear appearance of its cells under a microscope and can have different characteristics and prognosis compared to other subtypes.\n\nMC - Mucinous Carcinoma: Mucinous carcinoma is a rare subtype of ovarian cancer that is characterized by the presence of mucin-producing cells. It is typically diagnosed at an earlier stage and may have a better prognosis than high-grade serous carcinoma.","metadata":{}},{"cell_type":"code","source":"# Exploring image dimensions\n\ntrain_df[['image_height', 'image_width']].describe()","metadata":{"execution":{"iopub.status.busy":"2023-10-06T18:03:59.685398Z","iopub.execute_input":"2023-10-06T18:03:59.685767Z","iopub.status.idle":"2023-10-06T18:03:59.709944Z","shell.execute_reply.started":"2023-10-06T18:03:59.685738Z","shell.execute_reply":"2023-10-06T18:03:59.709148Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Exploring 'the label' in detail!\n\ntrain_df.is_tma.value_counts().plot(kind='bar')","metadata":{"execution":{"iopub.status.busy":"2023-10-06T18:09:23.841117Z","iopub.execute_input":"2023-10-06T18:09:23.841588Z","iopub.status.idle":"2023-10-06T18:09:24.104539Z","shell.execute_reply.started":"2023-10-06T18:09:23.841556Z","shell.execute_reply":"2023-10-06T18:09:24.103331Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"class_labels = train_df['label'].unique()\nfig, axes = plt.subplots(nrows=len(class_labels), figsize=(4, 8), sharex=True)\n\nfor i, class_label in enumerate(class_labels):\n    class_df = train_df[train_df['label'] == class_label]\n    class_df['is_tma'].value_counts().plot(kind='bar', ax=axes[i])\n    axes[i].set_title(f'Label {class_label}')\n    axes[i].set_xlabel('is_tma')\n    axes[i].set_ylabel('Count')\n\nplt.tight_layout()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-10-06T18:19:58.312383Z","iopub.execute_input":"2023-10-06T18:19:58.312778Z","iopub.status.idle":"2023-10-06T18:19:59.290993Z","shell.execute_reply.started":"2023-10-06T18:19:58.312748Z","shell.execute_reply":"2023-10-06T18:19:59.290152Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import os\n\nprint(train_df.image_id.shape[0])\nprint(len(os.listdir('/kaggle/input/UBC-OCEAN/train_images')))\nprint(len(os.listdir('/kaggle/input/UBC-OCEAN/train_thumbnails')))","metadata":{"execution":{"iopub.status.busy":"2023-10-06T18:22:58.708822Z","iopub.execute_input":"2023-10-06T18:22:58.709168Z","iopub.status.idle":"2023-10-06T18:22:58.716346Z","shell.execute_reply.started":"2023-10-06T18:22:58.709143Z","shell.execute_reply":"2023-10-06T18:22:58.715416Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# sample training image\n\nio.imshow('/kaggle/input/UBC-OCEAN/train_thumbnails/10077_thumbnail.png')","metadata":{"execution":{"iopub.status.busy":"2023-10-06T18:25:01.758196Z","iopub.execute_input":"2023-10-06T18:25:01.758607Z","iopub.status.idle":"2023-10-06T18:25:03.331835Z","shell.execute_reply.started":"2023-10-06T18:25:01.758576Z","shell.execute_reply":"2023-10-06T18:25:03.330844Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"MORE TO COME!","metadata":{}},{"cell_type":"markdown","source":"# HIT UPVOTE! Support for more detailed analysis and codes as competition progresses!","metadata":{}},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}