{"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":"# Introduction\n\nHey, thanks for viewing my Kernel!\n\nIf you like my work, please, leave an upvote: it will be really appreciated and it will motivate me in offering more content to the Kaggle community ! 😊","metadata":{}},{"cell_type":"code","source":"!pip install featdist","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2022-12-06T07:53:55.155154Z","iopub.execute_input":"2022-12-06T07:53:55.155582Z","iopub.status.idle":"2022-12-06T07:54:09.549061Z","shell.execute_reply.started":"2022-12-06T07:53:55.155545Z","shell.execute_reply":"2022-12-06T07:54:09.547461Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from featdist import numerical_ttt_dist\nfrom featdist import categorical_ttt_dist","metadata":{"execution":{"iopub.status.busy":"2022-12-06T07:54:09.55221Z","iopub.execute_input":"2022-12-06T07:54:09.553214Z","iopub.status.idle":"2022-12-06T07:54:09.563555Z","shell.execute_reply.started":"2022-12-06T07:54:09.553162Z","shell.execute_reply":"2022-12-06T07:54:09.562155Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport gc\nimport warnings\nimport datetime as dt\nimport math\nimport time\nimport pickle\nfrom tqdm import tqdm\n\nimport cv2\nimport skimage\nimport pydicom\n\nnp.random.seed(0)\nwarnings.simplefilter(\"ignore\")","metadata":{"execution":{"iopub.status.busy":"2022-12-06T07:20:29.015588Z","iopub.execute_input":"2022-12-06T07:20:29.016927Z","iopub.status.idle":"2022-12-06T07:20:30.748787Z","shell.execute_reply.started":"2022-12-06T07:20:29.016749Z","shell.execute_reply":"2022-12-06T07:20:30.747539Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = pd.read_csv(\"/kaggle/input/rsna-breast-cancer-detection/train.csv\")\ntest = pd.read_csv(\"/kaggle/input/rsna-breast-cancer-detection/test.csv\")\nsub = pd.read_csv(\"/kaggle/input/rsna-breast-cancer-detection/sample_submission.csv\")\n\ndisplay(train.head())\ndisplay(test.head())\ndisplay(sub.head())","metadata":{"execution":{"iopub.status.busy":"2022-12-06T07:21:42.434684Z","iopub.execute_input":"2022-12-06T07:21:42.435119Z","iopub.status.idle":"2022-12-06T07:21:42.606713Z","shell.execute_reply.started":"2022-12-06T07:21:42.435083Z","shell.execute_reply":"2022-12-06T07:21:42.605425Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"train shape:\", train.shape)\nprint(\"test shape:\", test.shape)\nprint(\"sub shape:\", sub.shape)","metadata":{"execution":{"iopub.status.busy":"2022-12-03T11:24:18.129765Z","iopub.execute_input":"2022-12-03T11:24:18.130189Z","iopub.status.idle":"2022-12-03T11:24:18.137363Z","shell.execute_reply.started":"2022-12-03T11:24:18.130157Z","shell.execute_reply":"2022-12-03T11:24:18.136126Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"train nan value sum:\", train.isna().sum().sum())\nprint(\"test nan value sum:\", test.isna().sum().sum())","metadata":{"execution":{"iopub.status.busy":"2022-12-03T11:24:30.249587Z","iopub.execute_input":"2022-12-03T11:24:30.250075Z","iopub.status.idle":"2022-12-03T11:24:30.269652Z","shell.execute_reply.started":"2022-12-03T11:24:30.250032Z","shell.execute_reply":"2022-12-03T11:24:30.268397Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2022-12-03T11:25:36.06022Z","iopub.execute_input":"2022-12-03T11:25:36.060682Z","iopub.status.idle":"2022-12-03T11:25:36.084133Z","shell.execute_reply.started":"2022-12-03T11:25:36.060647Z","shell.execute_reply":"2022-12-03T11:25:36.082728Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"train dublicated value sum:\", train.duplicated().sum().sum())\nprint(\"test dublicated value sum:\", test.duplicated().sum().sum())","metadata":{"execution":{"iopub.status.busy":"2022-12-03T11:24:38.745843Z","iopub.execute_input":"2022-12-03T11:24:38.746325Z","iopub.status.idle":"2022-12-03T11:24:38.79311Z","shell.execute_reply.started":"2022-12-03T11:24:38.746288Z","shell.execute_reply":"2022-12-03T11:24:38.79204Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train[\"cancer\"].value_counts(normalize=True)","metadata":{"execution":{"iopub.status.busy":"2022-12-03T11:28:04.625354Z","iopub.execute_input":"2022-12-03T11:28:04.625867Z","iopub.status.idle":"2022-12-03T11:28:04.638777Z","shell.execute_reply.started":"2022-12-03T11:28:04.625827Z","shell.execute_reply":"2022-12-03T11:28:04.637821Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"num_features = test.select_dtypes([\"int64\", \"float64\", \"bool\"]).columns.tolist()\ncat_features = test.select_dtypes([\"object\"]).columns.tolist()\ncat_features.remove(\"prediction_id\")\n\nprint(\"num_features: \", num_features)\nprint(\"cat_features: \", cat_features)","metadata":{"execution":{"iopub.status.busy":"2022-12-06T07:21:45.787669Z","iopub.execute_input":"2022-12-06T07:21:45.78816Z","iopub.status.idle":"2022-12-06T07:21:45.811874Z","shell.execute_reply.started":"2022-12-06T07:21:45.788113Z","shell.execute_reply":"2022-12-06T07:21:45.810215Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Exploratory Data Analysis","metadata":{}},{"cell_type":"code","source":"def get_sample(data=None, sample_num=5, ncols=5, size=\"512\", figsize=16, title=\"\"):\n    size = str(size)\n    base_path = \"/kaggle/input/rsna-mammography-images-as-pngs/images_as_pngs_\"+size\n    base_path += \"/train_images_processed_\"+size+\"/\"\n    \n    random_data = data.sample(sample_num)[[\"patient_id\", \"image_id\"]]\n    random_data[\"image_path\"] = random_data[\"patient_id\"].astype(str) + '/' + random_data[\"image_id\"].astype(str) + '.png'\n    random_data.reset_index(inplace=True, drop=True)\n    \n    nrows = int(sample_num / ncols)\n    if sample_num % ncols != 0:\n        nrows += 1\n    fig, axes = plt.subplots(nrows, ncols, figsize=(figsize, round(nrows*figsize/ncols)))\n    fig.suptitle(title)\n    for index, ax in enumerate(axes.ravel()[:sample_num]):\n        image_path = random_data.loc[index,\"image_path\"]\n        frame = cv2.imread(base_path+image_path)\n        ax.imshow(frame, cmap=\"gray\")","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-12-06T07:53:48.270675Z","iopub.execute_input":"2022-12-06T07:53:48.271352Z","iopub.status.idle":"2022-12-06T07:53:48.282418Z","shell.execute_reply.started":"2022-12-06T07:53:48.271298Z","shell.execute_reply":"2022-12-06T07:53:48.281317Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_num_stats = numerical_ttt_dist(train=train, test=test, features=num_features, target=\"cancer\", ncols=3, nbins=50)\ndf_num_stats","metadata":{"execution":{"iopub.status.busy":"2022-12-06T07:55:04.000611Z","iopub.execute_input":"2022-12-06T07:55:04.001097Z","iopub.status.idle":"2022-12-06T07:55:07.038193Z","shell.execute_reply.started":"2022-12-06T07:55:04.001057Z","shell.execute_reply":"2022-12-06T07:55:07.036936Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Insights 1\n* Age is positively correlated with cancer.\n* Distributions of train and test data differ because of the size of the test dataset.","metadata":{}},{"cell_type":"code","source":"df_cat_stats = categorical_ttt_dist(train=train, test=test, features=cat_features, target=\"cancer\", ncols=2)\ndf_cat_stats","metadata":{"execution":{"iopub.status.busy":"2022-12-06T07:55:07.040373Z","iopub.execute_input":"2022-12-06T07:55:07.040718Z","iopub.status.idle":"2022-12-06T07:55:08.838728Z","shell.execute_reply.started":"2022-12-06T07:55:07.040685Z","shell.execute_reply":"2022-12-06T07:55:08.837829Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Insights 2\n* Laterality looks not important for cancer.\n* The view is important for cancer. AT has the most cancer ratio.","metadata":{}},{"cell_type":"code","source":"condition = ((train[\"view\"]==\"CC\")&(train[\"implant\"]==1)&(train[\"laterality\"]==\"R\"))\nget_sample(data=train.loc[condition,], sample_num=10, title=\"implant = 1\")","metadata":{"execution":{"iopub.status.busy":"2022-12-06T08:06:25.993744Z","iopub.execute_input":"2022-12-06T08:06:25.994166Z","iopub.status.idle":"2022-12-06T08:06:27.76509Z","shell.execute_reply.started":"2022-12-06T08:06:25.994132Z","shell.execute_reply":"2022-12-06T08:06:27.764213Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"implant_matrix = pd.crosstab(train[\"implant\"],train[\"cancer\"])\nimplant_matrix","metadata":{"execution":{"iopub.status.busy":"2022-12-06T08:09:33.527245Z","iopub.execute_input":"2022-12-06T08:09:33.528338Z","iopub.status.idle":"2022-12-06T08:09:33.560758Z","shell.execute_reply.started":"2022-12-06T08:09:33.528286Z","shell.execute_reply":"2022-12-06T08:09:33.559447Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"implant_recall_score = 13/(13+1464)\nimplant_precision_score = 13/(13+1145)\nprint(\"Implant preds score Recall score:\", implant_recall_score)\nprint(\"Implant preds score Precision score:\", implant_precision_score)\nprint(\"Implant preds score F1 score:\", 2*implant_precision_score*implant_recall_score/(implant_precision_score+\n                                                                                       implant_recall_score))","metadata":{"execution":{"iopub.status.busy":"2022-12-06T08:12:44.649707Z","iopub.execute_input":"2022-12-06T08:12:44.650177Z","iopub.status.idle":"2022-12-06T08:12:44.658033Z","shell.execute_reply.started":"2022-12-06T08:12:44.650142Z","shell.execute_reply":"2022-12-06T08:12:44.656553Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Insights 3\n* Only implant looks not important for cancer because of the low recall score. Maybe we should look at this with age.","metadata":{}},{"cell_type":"code","source":"train_group = train.groupby([\"age\", \"implant\"],as_index=False).agg({\"cancer\":\"mean\"})\nfig, ax = plt.subplots(figsize=(16,8))\nsns.lineplot(data=train_group, x=\"age\", y=\"cancer\", hue=\"implant\",ax=ax);","metadata":{"execution":{"iopub.status.busy":"2022-12-06T08:23:21.564163Z","iopub.execute_input":"2022-12-06T08:23:21.564627Z","iopub.status.idle":"2022-12-06T08:23:21.888592Z","shell.execute_reply.started":"2022-12-06T08:23:21.564586Z","shell.execute_reply":"2022-12-06T08:23:21.887364Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Insights 4\n* As we can see in the age-cancer-implant graph, an implant is so dangerous after 70.","metadata":{}},{"cell_type":"code","source":"condition = ((train[\"cancer\"]==0)&(train[\"view\"]==\"AT\"))\nget_sample(data=train.loc[condition,], sample_num=2, ncols=2, title=\"Cancer = 0\")","metadata":{"execution":{"iopub.status.busy":"2022-12-06T08:04:18.599309Z","iopub.execute_input":"2022-12-06T08:04:18.599732Z","iopub.status.idle":"2022-12-06T08:04:19.196288Z","shell.execute_reply.started":"2022-12-06T08:04:18.599696Z","shell.execute_reply":"2022-12-06T08:04:19.194928Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"condition = ((train[\"cancer\"]==1)&(train[\"view\"]==\"AT\"))\nget_sample(data=train.loc[condition,], sample_num=2, ncols=2, title=\"Cancer = 1\")","metadata":{"execution":{"iopub.status.busy":"2022-12-06T08:04:21.872188Z","iopub.execute_input":"2022-12-06T08:04:21.872571Z","iopub.status.idle":"2022-12-06T08:04:22.469124Z","shell.execute_reply.started":"2022-12-06T08:04:21.87254Z","shell.execute_reply":"2022-12-06T08:04:22.467957Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"condition = ((train[\"cancer\"]==0)&(train[\"view\"]==\"CC\"))\nget_sample(data=train.loc[condition,], sample_num=10, ncols=5, title=\"Cancer = 0\")","metadata":{"execution":{"iopub.status.busy":"2022-12-06T08:04:42.541816Z","iopub.execute_input":"2022-12-06T08:04:42.542256Z","iopub.status.idle":"2022-12-06T08:04:44.889736Z","shell.execute_reply.started":"2022-12-06T08:04:42.54222Z","shell.execute_reply":"2022-12-06T08:04:44.887951Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"condition = ((train[\"cancer\"]==1)&(train[\"view\"]==\"CC\"))\nget_sample(data=train.loc[condition,], sample_num=10, ncols=5, title=\"Cancer = 1\")","metadata":{"execution":{"iopub.status.busy":"2022-12-06T08:04:53.29719Z","iopub.execute_input":"2022-12-06T08:04:53.29765Z","iopub.status.idle":"2022-12-06T08:04:55.104855Z","shell.execute_reply.started":"2022-12-06T08:04:53.297612Z","shell.execute_reply":"2022-12-06T08:04:55.103753Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# HOG Features\n\nHOG (Histogram of Oriented Gradients) is a feature that shows the gradients in the selected window size. You can see and example of the calculation below.\n\n![](https://www.mdpi.com/sensors/sensors-16-01134/article_deploy/html/images/sensors-16-01134-g002.png)\nref: https://www.mdpi.com/1424-8220/16/7/1134","metadata":{}},{"cell_type":"code","source":"size = \"512\"\nbase_path = \"/kaggle/input/rsna-mammography-images-as-pngs/images_as_pngs_\"+size\nbase_path += \"/train_images_processed_\"+size+\"/\"\n\nimage_path = \"10006/1459541791.png\"\ntest_image = cv2.imread(base_path+image_path)\ntest_image.shape","metadata":{"execution":{"iopub.status.busy":"2022-12-06T07:21:54.868837Z","iopub.execute_input":"2022-12-06T07:21:54.869334Z","iopub.status.idle":"2022-12-06T07:21:54.929095Z","shell.execute_reply.started":"2022-12-06T07:21:54.869292Z","shell.execute_reply":"2022-12-06T07:21:54.927794Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fd, hog_image = skimage.feature.hog(test_image, orientations=9, pixels_per_cell=(8, 8), \n                            cells_per_block=(2, 2), visualize=True, multichannel=True)\nfig, axes = plt.subplots(1, 2, figsize=(16,8))\naxes[0].imshow(test_image, cmap=\"gray\")\naxes[1].imshow(hog_image, cmap=\"gray\");","metadata":{"execution":{"iopub.status.busy":"2022-12-06T07:21:57.743643Z","iopub.execute_input":"2022-12-06T07:21:57.744041Z","iopub.status.idle":"2022-12-06T07:21:59.306573Z","shell.execute_reply.started":"2022-12-06T07:21:57.744007Z","shell.execute_reply":"2022-12-06T07:21:59.305622Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Drop nan gradients values\nfd = fd[fd!=0]\n\nfig, ax = plt.subplots(figsize=(16,4))\nax.hist(fd, bins=180);\nax.set_title(\"Test Image HOG Features Hist\");","metadata":{"execution":{"iopub.status.busy":"2022-12-06T08:44:05.402942Z","iopub.execute_input":"2022-12-06T08:44:05.403726Z","iopub.status.idle":"2022-12-06T08:44:05.957045Z","shell.execute_reply.started":"2022-12-06T08:44:05.403689Z","shell.execute_reply":"2022-12-06T08:44:05.955711Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fd.shape, hog_image.shape, test_image.shape","metadata":{"execution":{"iopub.status.busy":"2022-12-06T07:23:40.64394Z","iopub.execute_input":"2022-12-06T07:23:40.645166Z","iopub.status.idle":"2022-12-06T07:23:40.652565Z","shell.execute_reply.started":"2022-12-06T07:23:40.645116Z","shell.execute_reply":"2022-12-06T07:23:40.651474Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_hog_features(data=None, size=\"512\"):\n    size = str(size)\n    base_path = \"/kaggle/input/rsna-mammography-images-as-pngs/images_as_pngs_\"+size\n    base_path += \"/train_images_processed_\"+size+\"/\"\n    \n    data[\"image_path\"] = data[\"patient_id\"].astype(str) + '/' + data[\"image_id\"].astype(str) + '.png'\n    bins = np.linspace(0, 1, 181)\n    hog_features = np.zeros((len(data), 180))\n    for index, row in tqdm(data.iterrows()):\n        image_path = row[\"image_path\"]\n        frame = cv2.imread(base_path+image_path)\n    \n        fd = skimage.feature.hog(frame, orientations=9, pixels_per_cell=(8, 8), \n                                 cells_per_block=(2, 2), visualize=False, multichannel=True)\n        hist = np.histogram(fd, bins=bins)\n        hog_features[index] = hist[0]\n    return hog_features","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-12-06T07:23:49.493041Z","iopub.execute_input":"2022-12-06T07:23:49.493439Z","iopub.status.idle":"2022-12-06T07:23:49.503207Z","shell.execute_reply.started":"2022-12-06T07:23:49.493407Z","shell.execute_reply":"2022-12-06T07:23:49.501758Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"'''\ntrain_hog_features = get_hog_features(data=train)\n\nwith open('train_hog_features.pkl','wb') as f:\n    pickle.dump(train_hog_features, f)\n'''\n\ntrain_hog_features = pickle.load(open(\"/kaggle/input/advanced-dataset/RSNA/train_hog_features.pkl\", \"rb\"))\ny = train[\"cancer\"].values\ntrain_hog_features.shape, y.shape","metadata":{"execution":{"iopub.status.busy":"2022-12-06T07:26:18.969583Z","iopub.execute_input":"2022-12-06T07:26:18.970881Z","iopub.status.idle":"2022-12-06T07:26:19.114545Z","shell.execute_reply.started":"2022-12-06T07:26:18.97079Z","shell.execute_reply":"2022-12-06T07:26:19.113279Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_hog_features_0 = train_hog_features[y==0]\ntrain_hog_features_1 = train_hog_features[y==1]\ntrain_hog_features_0.shape, train_hog_features_1.shape","metadata":{"execution":{"iopub.status.busy":"2022-12-06T07:39:30.399474Z","iopub.execute_input":"2022-12-06T07:39:30.399915Z","iopub.status.idle":"2022-12-06T07:39:30.438247Z","shell.execute_reply.started":"2022-12-06T07:39:30.399872Z","shell.execute_reply":"2022-12-06T07:39:30.437199Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from scipy.stats import kstest\n\ndist_diffs = np.zeros(train_hog_features_0.shape[1])\nfor col_index in range(train_hog_features_0.shape[1]):\n    dist_diff, _ = kstest(train_hog_features_0[:,col_index], train_hog_features_1[:,col_index])\n    dist_diffs[col_index] = dist_diff","metadata":{"execution":{"iopub.status.busy":"2022-12-06T07:46:29.493535Z","iopub.execute_input":"2022-12-06T07:46:29.49392Z","iopub.status.idle":"2022-12-06T07:46:31.2798Z","shell.execute_reply.started":"2022-12-06T07:46:29.493888Z","shell.execute_reply":"2022-12-06T07:46:31.278389Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"np.argmax(dist_diffs)","metadata":{"execution":{"iopub.status.busy":"2022-12-06T07:46:31.863515Z","iopub.execute_input":"2022-12-06T07:46:31.864124Z","iopub.status.idle":"2022-12-06T07:46:31.871598Z","shell.execute_reply.started":"2022-12-06T07:46:31.864092Z","shell.execute_reply":"2022-12-06T07:46:31.870465Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(figsize=(16, 4))\nax.hist(train_hog_features_0[:, 101], bins=30, density=True, alpha=0.5, label=\"cancer = 0\")\nax.hist(train_hog_features_1[:, 101], bins=30, density=True, alpha=0.5, label=\"cancer = 1\")\nax.legend()\nax.set_title(\"101. Gradient\");","metadata":{"execution":{"iopub.status.busy":"2022-12-06T08:43:26.578482Z","iopub.execute_input":"2022-12-06T08:43:26.578941Z","iopub.status.idle":"2022-12-06T08:43:27.005268Z","shell.execute_reply.started":"2022-12-06T08:43:26.578901Z","shell.execute_reply":"2022-12-06T08:43:27.003726Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Insights 5\n* Cancer 101. gradient has most different distribution than healty.\n* If all images are flipped the right way, HOG features give us more accurate results.","metadata":{}},{"cell_type":"markdown","source":"# Modeling","metadata":{}},{"cell_type":"code","source":"from sklearn.model_selection import cross_val_score\nfrom sklearn.preprocessing import PowerTransformer\nfrom sklearn.naive_bayes import GaussianNB\nfrom sklearn.pipeline import make_pipeline\n\nmodel = make_pipeline(PowerTransformer(), GaussianNB())\nscores = cross_val_score(model, train_hog_features, y, cv=5, scoring=\"roc_auc\")\nprint(\"scores:\", scores)","metadata":{"execution":{"iopub.status.busy":"2022-12-06T08:37:11.134669Z","iopub.execute_input":"2022-12-06T08:37:11.135765Z","iopub.status.idle":"2022-12-06T08:38:02.425239Z","shell.execute_reply.started":"2022-12-06T08:37:11.135722Z","shell.execute_reply":"2022-12-06T08:38:02.423936Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Insights 6\n* GaussianNB has more than 0.5 ROC AUC score. It means that the model can learn from HOG features.\n* We can increase the score by flipping all images in the same direction and increasing the bin numbers. Now the bin number is 180.","metadata":{}},{"cell_type":"markdown","source":"# Conclusions\n\n## Insights 1\n* Age is positively correlated with cancer.\n* Distributions of train and test data differ because of the size of the test dataset.\n\n## Insights 2\n* Laterality looks not important for cancer.\n* The view is important for cancer. AT has the most cancer ratio.\n\n## Insights 3\n* Only implant looks not important for cancer because of the low recall score. Maybe we should look at this with age.\n\n## Insights 4\n* As we can see in the age-cancer-implant graph, an implant is so dangerous after 70.\n\n## Insights 5\n* Cancer 101. gradient has most different distribution than healty.\n* If all images are flipped the right way, HOG features give us more accurate results.\n\n## Insights 6\n* GaussianNB has more than 0.5 ROC AUC score. It means that the model can learn from HOG features.\n* We can increase the score by flipping all images in the same direction and increasing the bin numbers. Now the bin number is 180.","metadata":{}}]}