{"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":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nimport pydicom\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-12-11T10:40:56.819951Z","iopub.execute_input":"2022-12-11T10:40:56.82051Z","iopub.status.idle":"2022-12-11T10:40:56.827686Z","shell.execute_reply.started":"2022-12-11T10:40:56.820463Z","shell.execute_reply":"2022-12-11T10:40:56.826741Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_csv=pd.read_csv('/kaggle/input/rsna-breast-cancer-detection/train.csv')\ntrain_csv","metadata":{"execution":{"iopub.status.busy":"2022-12-11T10:38:13.231035Z","iopub.execute_input":"2022-12-11T10:38:13.232151Z","iopub.status.idle":"2022-12-11T10:38:13.417198Z","shell.execute_reply.started":"2022-12-11T10:38:13.232107Z","shell.execute_reply":"2022-12-11T10:38:13.415972Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Age vs Cancer\n\nsns.boxplot(x='cancer',y='age', data=train_csv);","metadata":{"execution":{"iopub.status.busy":"2022-12-11T11:20:59.0437Z","iopub.execute_input":"2022-12-11T11:20:59.044111Z","iopub.status.idle":"2022-12-11T11:20:59.238312Z","shell.execute_reply.started":"2022-12-11T11:20:59.044077Z","shell.execute_reply":"2022-12-11T11:20:59.237344Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# implants vs cancer distribution\n\nsns.catplot(x='cancer',y='age',hue='implant',kind='strip', data=train_csv);","metadata":{"execution":{"iopub.status.busy":"2022-12-11T11:19:56.516459Z","iopub.execute_input":"2022-12-11T11:19:56.517228Z","iopub.status.idle":"2022-12-11T11:19:58.117689Z","shell.execute_reply.started":"2022-12-11T11:19:56.517184Z","shell.execute_reply":"2022-12-11T11:19:58.116504Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The cancer cases has not impacted patients with breast implants more.","metadata":{}},{"cell_type":"code","source":"# cancer vs invasive distribution\ntemp=train_csv[train_csv['cancer']==1].copy()\nsns.catplot(x='cancer',y='age',hue='invasive',kind='bar', data=temp);\n","metadata":{"execution":{"iopub.status.busy":"2022-12-11T11:22:38.955433Z","iopub.execute_input":"2022-12-11T11:22:38.955868Z","iopub.status.idle":"2022-12-11T11:22:39.316964Z","shell.execute_reply.started":"2022-12-11T11:22:38.955829Z","shell.execute_reply":"2022-12-11T11:22:39.316113Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Of all the positive cancer cases, the freuency of invasive to non-invasive seems equal.","metadata":{}},{"cell_type":"code","source":"# cancer vs density\nsns.catplot(data=train_csv, x=\"density\", y=\"age\", hue='cancer', kind='strip');","metadata":{"execution":{"iopub.status.busy":"2022-12-11T11:25:16.024433Z","iopub.execute_input":"2022-12-11T11:25:16.024923Z","iopub.status.idle":"2022-12-11T11:25:17.176136Z","shell.execute_reply.started":"2022-12-11T11:25:16.024881Z","shell.execute_reply":"2022-12-11T11:25:17.174858Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"For density type D, we are noticing less instances of positive cancer cases","metadata":{}},{"cell_type":"code","source":"# laterality vs cancer\nsns.catplot(data=train_csv, x=\"laterality\", y=\"age\", hue='cancer', kind='strip');","metadata":{"execution":{"iopub.status.busy":"2022-12-11T11:27:22.240877Z","iopub.execute_input":"2022-12-11T11:27:22.242146Z","iopub.status.idle":"2022-12-11T11:27:23.854532Z","shell.execute_reply.started":"2022-12-11T11:27:22.242095Z","shell.execute_reply":"2022-12-11T11:27:23.853342Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Laterality value L shows more incidence of positive cases of cancer for the train set.","metadata":{}},{"cell_type":"code","source":"# view vs cancer distributiom\nsns.catplot(data=train_csv, x=\"view\", y=\"age\", hue='cancer', kind='strip');","metadata":{"execution":{"iopub.status.busy":"2022-12-11T11:31:23.457216Z","iopub.execute_input":"2022-12-11T11:31:23.457706Z","iopub.status.idle":"2022-12-11T11:31:25.205603Z","shell.execute_reply.started":"2022-12-11T11:31:23.457644Z","shell.execute_reply":"2022-12-11T11:31:25.204446Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"CC and MLO views have most positive cases of cancer.","metadata":{}},{"cell_type":"code","source":"sns.catplot(data=train_csv, x=\"BIRADS\", y=\"age\", hue='cancer', kind='strip');","metadata":{"execution":{"iopub.status.busy":"2022-12-11T11:37:04.776321Z","iopub.execute_input":"2022-12-11T11:37:04.776814Z","iopub.status.idle":"2022-12-11T11:37:05.796709Z","shell.execute_reply.started":"2022-12-11T11:37:04.776773Z","shell.execute_reply":"2022-12-11T11:37:05.79573Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.catplot(data=train_csv, x=\"machine_id\", y=\"age\", hue='cancer', kind='strip');","metadata":{"execution":{"iopub.status.busy":"2022-12-11T11:39:57.18688Z","iopub.execute_input":"2022-12-11T11:39:57.187361Z","iopub.status.idle":"2022-12-11T11:39:59.175726Z","shell.execute_reply.started":"2022-12-11T11:39:57.187321Z","shell.execute_reply":"2022-12-11T11:39:59.174743Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"We find there are no positive cases detected by the machines 197, 210, 216","metadata":{}},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Target distribution\nsns.countplot(data=train_csv, x='cancer');","metadata":{"execution":{"iopub.status.busy":"2022-12-11T12:23:35.761157Z","iopub.execute_input":"2022-12-11T12:23:35.761684Z","iopub.status.idle":"2022-12-11T12:23:35.946116Z","shell.execute_reply.started":"2022-12-11T12:23:35.761627Z","shell.execute_reply":"2022-12-11T12:23:35.944833Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"There is class imbalance in this dataset","metadata":{}}]}