{"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":"markdown","source":"# Cancer🔬 Classif: All would be just one class\n\nAs random could also miss all correct preditions we try to send all to be the major class","metadata":{}},{"cell_type":"code","source":"import os, glob\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nDATASET_FOLDER = \"/kaggle/input/UBC-OCEAN/\"","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-10-27T12:55:37.643144Z","iopub.execute_input":"2023-10-27T12:55:37.643768Z","iopub.status.idle":"2023-10-27T12:55:38.079394Z","shell.execute_reply.started":"2023-10-27T12:55:37.643737Z","shell.execute_reply":"2023-10-27T12:55:38.078471Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## train & test data","metadata":{}},{"cell_type":"code","source":"df_train = pd.read_csv(os.path.join(DATASET_FOLDER, \"train.csv\"))\n# labels = list(df_train[\"label\"].unique())\nprint(f\"Dataset/train size: {len(df_train)}\")\ndisplay(df_train.head())","metadata":{"execution":{"iopub.status.busy":"2023-10-27T12:55:38.081602Z","iopub.execute_input":"2023-10-27T12:55:38.082419Z","iopub.status.idle":"2023-10-27T12:55:38.1224Z","shell.execute_reply.started":"2023-10-27T12:55:38.082383Z","shell.execute_reply":"2023-10-27T12:55:38.121248Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"_= df_train[[\"label\"]].value_counts().plot.pie(autopct='%1.1f%%', ylabel=\"label\")","metadata":{"execution":{"iopub.status.busy":"2023-10-27T12:55:38.123952Z","iopub.execute_input":"2023-10-27T12:55:38.124403Z","iopub.status.idle":"2023-10-27T12:55:38.37917Z","shell.execute_reply.started":"2023-10-27T12:55:38.124364Z","shell.execute_reply":"2023-10-27T12:55:38.377591Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_test = pd.read_csv(os.path.join(DATASET_FOLDER, \"test.csv\"))\n# labels = list(df_train[\"label\"].unique())\nprint(f\"Dataset/test size: {len(df_test)}\")\ndisplay(df_test.head())","metadata":{"execution":{"iopub.status.busy":"2023-10-27T12:55:38.38123Z","iopub.execute_input":"2023-10-27T12:55:38.382605Z","iopub.status.idle":"2023-10-27T12:55:38.408574Z","shell.execute_reply.started":"2023-10-27T12:55:38.382548Z","shell.execute_reply":"2023-10-27T12:55:38.406683Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Sample submission","metadata":{}},{"cell_type":"code","source":"df_sub = pd.read_csv(os.path.join(DATASET_FOLDER, \"sample_submission.csv\"))\nprint(f\"Submission size: {len(df_sub)}\")\ndisplay(df_sub.head())","metadata":{"execution":{"iopub.status.busy":"2023-10-27T12:55:38.413313Z","iopub.execute_input":"2023-10-27T12:55:38.413926Z","iopub.status.idle":"2023-10-27T12:55:38.430519Z","shell.execute_reply.started":"2023-10-27T12:55:38.413874Z","shell.execute_reply":"2023-10-27T12:55:38.429756Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"assert len(df_test) == len(df_sub), f\"the submission {len(df_sub),} is not equal to test {len(df_test)}\"","metadata":{"execution":{"iopub.status.busy":"2023-10-27T12:55:38.431721Z","iopub.execute_input":"2023-10-27T12:55:38.432226Z","iopub.status.idle":"2023-10-27T12:55:38.436414Z","shell.execute_reply.started":"2023-10-27T12:55:38.432197Z","shell.execute_reply":"2023-10-27T12:55:38.435484Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Generate dummy submission\n\nAs 40% cases is HGSC lest assume all in tets is `HGSC`","metadata":{}},{"cell_type":"code","source":"df_test[\"label\"] = [\"HGSC\"] * len(df_test)\ndisplay(df_test.head())","metadata":{"execution":{"iopub.status.busy":"2023-10-27T12:55:38.437585Z","iopub.execute_input":"2023-10-27T12:55:38.438063Z","iopub.status.idle":"2023-10-27T12:55:38.458055Z","shell.execute_reply.started":"2023-10-27T12:55:38.438022Z","shell.execute_reply":"2023-10-27T12:55:38.45699Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Save submision 💾","metadata":{}},{"cell_type":"code","source":"df_test[[\"image_id\", \"label\"]].to_csv(\"submission.csv\", index=False)\n\n! head submission.csv","metadata":{"execution":{"iopub.status.busy":"2023-10-27T12:55:38.459261Z","iopub.execute_input":"2023-10-27T12:55:38.459901Z","iopub.status.idle":"2023-10-27T12:55:39.566183Z","shell.execute_reply.started":"2023-10-27T12:55:38.45987Z","shell.execute_reply":"2023-10-27T12:55:39.564612Z"},"trusted":true},"execution_count":null,"outputs":[]}]}