{"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":"# H&M - EDA - first look into data \n\n","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19"}},{"cell_type":"markdown","source":"This is very sample EDA for H&M Personalized Fashion Recommendations. I just created this EDA for quick jump into competition. Hope you find it useful for your own competition start. Enjoy and ... have a fun in competiton!\n\n<div align=\"center\"><img src=\"https://i.ibb.co/xJqnpfJ/HM.jpg\"/></div>\n\n# COMPETITION GOAL\n\nIn this competition, H&M Group invites you to develop product recommendations based on data from previous transactions, as well as from customer and product meta data. The available meta data spans from simple data, such as garment type and customer age, to text data from product descriptions, to image data from garment images.\n\nThis competition required broad ML knnowledge:\n- computer vision - there are product images in dataset\n- tabular data - three datasets\n- NLP - product description contains interesting data ... eg. words \"EXCLUSIVE\" ..","metadata":{}},{"cell_type":"code","source":"import cv2\nimport numpy as np # linear algebra\nimport os\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport plotly.express as px\nfrom os import listdir\nfrom os.path import isfile, join\n\nfrom termcolor import colored\nfrom IPython.display import HTML\n\nimport warnings\npd.set_option('display.max_rows', None)\npd.set_option('display.max_columns', None)\npd.set_option('float_format', '{:f}'.format)\nwarnings.filterwarnings('ignore')","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T15:53:54.842898Z","iopub.execute_input":"2022-02-08T15:53:54.843206Z","iopub.status.idle":"2022-02-08T15:53:57.448998Z","shell.execute_reply.started":"2022-02-08T15:53:54.843173Z","shell.execute_reply":"2022-02-08T15:53:57.448112Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"articles = pd.read_csv(\"../input/h-and-m-personalized-fashion-recommendations/articles.csv\")\ncustomers = pd.read_csv(\"../input/h-and-m-personalized-fashion-recommendations/customers.csv\")\ntransactions = pd.read_csv(\"../input/h-and-m-personalized-fashion-recommendations/transactions_train.csv\")","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T15:53:57.450808Z","iopub.execute_input":"2022-02-08T15:53:57.451129Z","iopub.status.idle":"2022-02-08T15:55:11.470025Z","shell.execute_reply.started":"2022-02-08T15:53:57.451091Z","shell.execute_reply":"2022-02-08T15:55:11.468790Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"images_dir = '../input/h-and-m-personalized-fashion-recommendations/images'\ncat_images = [f for f in listdir(images_dir)]","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T15:55:11.472736Z","iopub.execute_input":"2022-02-08T15:55:11.473055Z","iopub.status.idle":"2022-02-08T15:55:11.487163Z","shell.execute_reply.started":"2022-02-08T15:55:11.473018Z","shell.execute_reply":"2022-02-08T15:55:11.486009Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# EVALUATION METRIC\n\n<div align=\"center\"><img src=\"https://i.ibb.co/tDcYJhs/hm-metrics.jpg\" width=800/></div>","metadata":{}},{"cell_type":"markdown","source":"# DATASET INFORMATION","metadata":{}},{"cell_type":"code","source":"print(f\"Number of observations in ARTICLES: {colored(articles.shape, 'yellow')}\")\nprint(f\"Number of observations in CUSTOMERS: {colored(customers.shape, 'yellow')}\")\nprint(f\"Number of observations in TRANSACTIONS: {colored(transactions.shape, 'yellow')}\")","metadata":{"execution":{"iopub.status.busy":"2022-02-08T15:55:11.488243Z","iopub.execute_input":"2022-02-08T15:55:11.488464Z","iopub.status.idle":"2022-02-08T15:55:11.495562Z","shell.execute_reply.started":"2022-02-08T15:55:11.488437Z","shell.execute_reply":"2022-02-08T15:55:11.494670Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"* Competition dataset contains of Tabular data (three datasets - Articles, Customer, Transactions) and product images\n* There are three datasets in competion:\n    * Articles - 105.542 observations with 25 features\n    * Customers - 1.371.980 observations with 7 features\n    * Transactions - 31.788.324 observations with 5 features","metadata":{}},{"cell_type":"markdown","source":"# DATABASE RELATIONS\n<div align=\"center\"><img src=\"https://i.ibb.co/pRNSPDh/rel.jpg\"/ width=\"480\"></div>","metadata":{}},{"cell_type":"code","source":"# This code was borrowed from https://www.kaggle.com/ishandutta/v7-shopee-indepth-eda-one-stop-for-all-your-needs\ndef getImagePaths(path):\n    \"\"\"\n    Function to Combine Directory Path with individual Image Paths\n    \n    parameters: path(string) - Path of directory\n    returns: image_names(string) - Full Image Path\n    \"\"\"\n    image_names = []\n    for dirname, _, filenames in os.walk(path):\n        for filename in filenames:\n            fullpath = os.path.join(dirname, filename)\n            image_names.append(fullpath)\n    return image_names\n\ndef display_multiple_img(images_paths, rows, cols):\n    \"\"\"\n    Function to Display Images from Dataset.\n    \n    parameters: images_path(string) - Paths of Images to be displayed\n                rows(int) - No. of Rows in Output\n                cols(int) - No. of Columns in Output\n    \"\"\"\n    figure, ax = plt.subplots(nrows=rows,ncols=cols,figsize=(16,8) )\n    for ind,image_path in enumerate(images_paths):\n        image=cv2.imread(image_path)\n        image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) \n        try:\n            ax.ravel()[ind].imshow(image)\n            ax.ravel()[ind].set_axis_off()\n        except:\n            continue;\n    plt.tight_layout()\n    plt.show()\n\ndef plot_distribution(x, data, title):\n        fig = px.histogram(\n        data, \n        x = x,\n        width = 800,\n        height = 500,\n        title = title\n        )\n\n        fig.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T15:55:11.499029Z","iopub.execute_input":"2022-02-08T15:55:11.500085Z","iopub.status.idle":"2022-02-08T15:55:11.515144Z","shell.execute_reply.started":"2022-02-08T15:55:11.499889Z","shell.execute_reply":"2022-02-08T15:55:11.514154Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def disply_multiple_img_ids(idx, rows, cols):\n    figure, ax = plt.subplots(nrows=rows,ncols=cols,figsize=(16,8))\n    for ind, im_id in enumerate(idx):\n\n        image_path = f'{images_dir}/0{str(im_id)[:2]}/0{im_id}.jpg'\n        \n        image=cv2.imread(image_path)\n        image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) \n        try:\n            ax.ravel()[ind].imshow(image)\n            ax.ravel()[ind].set_axis_off()\n        except:\n            continue;\n    plt.tight_layout()\n    plt.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T15:55:11.516996Z","iopub.execute_input":"2022-02-08T15:55:11.517963Z","iopub.status.idle":"2022-02-08T15:55:11.534028Z","shell.execute_reply.started":"2022-02-08T15:55:11.517894Z","shell.execute_reply":"2022-02-08T15:55:11.533173Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"images_path = getImagePaths(images_dir)","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T15:55:11.536163Z","iopub.execute_input":"2022-02-08T15:55:11.536487Z","iopub.status.idle":"2022-02-08T15:56:11.666361Z","shell.execute_reply.started":"2022-02-08T15:55:11.536445Z","shell.execute_reply":"2022-02-08T15:56:11.665250Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(f\"There are {colored(len(images_path), 'yellow')} number of images in dataset\")","metadata":{"execution":{"iopub.status.busy":"2022-02-08T15:56:11.667795Z","iopub.execute_input":"2022-02-08T15:56:11.668129Z","iopub.status.idle":"2022-02-08T15:56:11.674419Z","shell.execute_reply.started":"2022-02-08T15:56:11.668079Z","shell.execute_reply":"2022-02-08T15:56:11.673286Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"display_multiple_img(images_path[50:100], 5, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:48:56.608820Z","iopub.execute_input":"2022-02-08T14:48:56.609466Z","iopub.status.idle":"2022-02-08T14:49:04.495289Z","shell.execute_reply.started":"2022-02-08T14:48:56.609415Z","shell.execute_reply":"2022-02-08T14:49:04.494148Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# QUICK LOOK INTO DATA\n\n## A. ARTICLES","metadata":{}},{"cell_type":"code","source":"articles.head(3)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T15:56:11.676113Z","iopub.execute_input":"2022-02-08T15:56:11.676668Z","iopub.status.idle":"2022-02-08T15:56:11.727563Z","shell.execute_reply.started":"2022-02-08T15:56:11.676623Z","shell.execute_reply":"2022-02-08T15:56:11.726990Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"articles.info()","metadata":{"execution":{"iopub.status.busy":"2022-02-08T15:56:11.728633Z","iopub.execute_input":"2022-02-08T15:56:11.729020Z","iopub.status.idle":"2022-02-08T15:56:11.961359Z","shell.execute_reply.started":"2022-02-08T15:56:11.728976Z","shell.execute_reply":"2022-02-08T15:56:11.960376Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"articles.iloc[:, :-1].describe().T.sort_values(by='std' , ascending = False)\\\n                     .style.background_gradient(cmap='GnBu')\\\n                     .bar(subset=[\"max\"], color='#F8766D')\\\n                     .bar(subset=[\"mean\",], color='#00BFC4')","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:04.748067Z","iopub.execute_input":"2022-02-08T14:49:04.748593Z","iopub.status.idle":"2022-02-08T14:49:04.918073Z","shell.execute_reply.started":"2022-02-08T14:49:04.748547Z","shell.execute_reply":"2022-02-08T14:49:04.917154Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(f\"There are {colored(articles.article_id.nunique(), 'yellow')} unique ARTICLES in customers dataset\")\nprint(f\"There are {colored(articles.product_code.nunique(), 'yellow')} unique PRODUCT CODES in dataset\")\nprint(f\"There are {colored(articles.prod_name.nunique(), 'yellow')} unique PRODUCT NAMES in dataset\")\nprint(f\"There are {colored(articles.product_type_no.nunique(), 'yellow')} unique PRODUCT TYPES in dataset\")","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:04.919999Z","iopub.execute_input":"2022-02-08T14:49:04.920657Z","iopub.status.idle":"2022-02-08T14:49:04.956190Z","shell.execute_reply.started":"2022-02-08T14:49:04.920602Z","shell.execute_reply":"2022-02-08T14:49:04.955627Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### LET'S DISCOVER ARTICLES STRUCTURE","metadata":{}},{"cell_type":"code","source":"articles.query(\"product_code == 108775\").T","metadata":{"execution":{"iopub.status.busy":"2022-02-08T16:05:13.876465Z","iopub.execute_input":"2022-02-08T16:05:13.877108Z","iopub.status.idle":"2022-02-08T16:05:13.896367Z","shell.execute_reply.started":"2022-02-08T16:05:13.877067Z","shell.execute_reply":"2022-02-08T16:05:13.895803Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"product_code == 108775\").article_id[:3], 1, 3)","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T16:06:23.289022Z","iopub.execute_input":"2022-02-08T16:06:23.289448Z","iopub.status.idle":"2022-02-08T16:06:24.826396Z","shell.execute_reply.started":"2022-02-08T16:06:23.289416Z","shell.execute_reply":"2022-02-08T16:06:24.825315Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### A. PRODUCT TYPE NAME","metadata":{}},{"cell_type":"code","source":"s = articles.product_type_name.value_counts()\ns_len = s / len(articles.index) * 100\n\nres = pd.concat([s, s_len], axis=1)\\\n        .set_axis(['TOP 10 - Product Type Name', '%'], axis=1, inplace=False)\n\nres.head(10)","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T14:49:04.959544Z","iopub.execute_input":"2022-02-08T14:49:04.959913Z","iopub.status.idle":"2022-02-08T14:49:04.993430Z","shell.execute_reply.started":"2022-02-08T14:49:04.959877Z","shell.execute_reply":"2022-02-08T14:49:04.992405Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_distribution('product_type_name', articles, 'Product Type Name')","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T14:49:04.994892Z","iopub.execute_input":"2022-02-08T14:49:04.995156Z","iopub.status.idle":"2022-02-08T14:49:07.203578Z","shell.execute_reply.started":"2022-02-08T14:49:04.995114Z","shell.execute_reply":"2022-02-08T14:49:07.202545Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### LET'S LOOK INTO PRODUCTS\n#### TROUSERS","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"product_type_name == 'Trousers'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:07.205203Z","iopub.execute_input":"2022-02-08T14:49:07.205427Z","iopub.status.idle":"2022-02-08T14:49:08.663140Z","shell.execute_reply.started":"2022-02-08T14:49:07.205399Z","shell.execute_reply":"2022-02-08T14:49:08.662039Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### T-SHIRTS","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"product_type_name == 'T-shirt'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:08.664367Z","iopub.execute_input":"2022-02-08T14:49:08.664575Z","iopub.status.idle":"2022-02-08T14:49:10.533492Z","shell.execute_reply.started":"2022-02-08T14:49:08.664550Z","shell.execute_reply":"2022-02-08T14:49:10.532577Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### B. PRODUCT GROUP NAME","metadata":{}},{"cell_type":"code","source":"s = articles.product_group_name.value_counts()\ns_len = s / len(articles.index) * 100\n\nres = pd.concat([s, s_len], axis=1)\\\n        .set_axis(['Product Group Name', '%'], axis=1, inplace=False)\n\nres","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T14:49:10.534858Z","iopub.execute_input":"2022-02-08T14:49:10.535071Z","iopub.status.idle":"2022-02-08T14:49:10.567753Z","shell.execute_reply.started":"2022-02-08T14:49:10.535043Z","shell.execute_reply":"2022-02-08T14:49:10.566702Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_distribution('product_group_name', articles, 'Product Group Name')","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T14:49:10.569570Z","iopub.execute_input":"2022-02-08T14:49:10.570453Z","iopub.status.idle":"2022-02-08T14:49:11.737124Z","shell.execute_reply.started":"2022-02-08T14:49:10.570396Z","shell.execute_reply":"2022-02-08T14:49:11.735211Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### SWIMWEAR","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"product_group_name == 'Swimwear'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:11.738919Z","iopub.execute_input":"2022-02-08T14:49:11.739205Z","iopub.status.idle":"2022-02-08T14:49:13.580773Z","shell.execute_reply.started":"2022-02-08T14:49:11.739171Z","shell.execute_reply":"2022-02-08T14:49:13.580100Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### BAGS","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"product_group_name == 'Bags'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:13.581919Z","iopub.execute_input":"2022-02-08T14:49:13.582666Z","iopub.status.idle":"2022-02-08T14:49:15.284569Z","shell.execute_reply.started":"2022-02-08T14:49:13.582626Z","shell.execute_reply":"2022-02-08T14:49:15.283859Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### GARMENT UPPER BODY AND ... SWEATER","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"product_group_name == 'Garment Upper body' \\\n                                        and product_type_name =='Sweater'\").article_id[:10], 2, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:15.286245Z","iopub.execute_input":"2022-02-08T14:49:15.286772Z","iopub.status.idle":"2022-02-08T14:49:19.018583Z","shell.execute_reply.started":"2022-02-08T14:49:15.286735Z","shell.execute_reply":"2022-02-08T14:49:19.017760Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### C. GRAPHICAL APPEARANCE NAME","metadata":{}},{"cell_type":"code","source":"s = articles.graphical_appearance_name.value_counts()\ns_len = s / len(articles.index) * 100\n\nres = pd.concat([s, s_len], axis=1)\\\n        .set_axis(['TOP 10 - Graphical Appearance Name', '%'], axis=1, inplace=False)\n\nres.head(10)","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T14:49:19.020098Z","iopub.execute_input":"2022-02-08T14:49:19.020544Z","iopub.status.idle":"2022-02-08T14:49:19.050379Z","shell.execute_reply.started":"2022-02-08T14:49:19.020510Z","shell.execute_reply":"2022-02-08T14:49:19.049672Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_distribution('graphical_appearance_name', articles, 'Product Appearance Name')","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:19.051898Z","iopub.execute_input":"2022-02-08T14:49:19.052170Z","iopub.status.idle":"2022-02-08T14:49:20.234211Z","shell.execute_reply.started":"2022-02-08T14:49:19.052111Z","shell.execute_reply":"2022-02-08T14:49:20.233226Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### PLACEMENT PRINT","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"graphical_appearance_name == 'Placement print'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:20.235619Z","iopub.execute_input":"2022-02-08T14:49:20.236475Z","iopub.status.idle":"2022-02-08T14:49:21.826089Z","shell.execute_reply.started":"2022-02-08T14:49:20.236428Z","shell.execute_reply":"2022-02-08T14:49:21.824985Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### SEQUIN","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"graphical_appearance_name == 'Sequin'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:21.827500Z","iopub.execute_input":"2022-02-08T14:49:21.827752Z","iopub.status.idle":"2022-02-08T14:49:23.754273Z","shell.execute_reply.started":"2022-02-08T14:49:21.827721Z","shell.execute_reply":"2022-02-08T14:49:23.753225Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### PLACEMENT PRINT AND SWIMWEAR","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"graphical_appearance_name == 'Placement print' \\\n                                        and product_group_name == 'Swimwear'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:23.756350Z","iopub.execute_input":"2022-02-08T14:49:23.756641Z","iopub.status.idle":"2022-02-08T14:49:26.020492Z","shell.execute_reply.started":"2022-02-08T14:49:23.756607Z","shell.execute_reply":"2022-02-08T14:49:26.019841Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### D. COLOR GROUP NAME","metadata":{}},{"cell_type":"code","source":"s = articles.colour_group_name.value_counts()\ns_len = s / len(articles.index) * 100\n\nres = pd.concat([s, s_len], axis=1)\\\n        .set_axis(['TOP 10 - Colour Group Name', '%'], axis=1, inplace=False)\n\nres.head(10)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:26.021628Z","iopub.execute_input":"2022-02-08T14:49:26.022827Z","iopub.status.idle":"2022-02-08T14:49:26.060932Z","shell.execute_reply.started":"2022-02-08T14:49:26.022716Z","shell.execute_reply":"2022-02-08T14:49:26.059700Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_distribution('colour_group_name', articles, 'Colour Group Name')","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T14:49:26.062751Z","iopub.execute_input":"2022-02-08T14:49:26.063002Z","iopub.status.idle":"2022-02-08T14:49:27.164018Z","shell.execute_reply.started":"2022-02-08T14:49:26.062972Z","shell.execute_reply":"2022-02-08T14:49:27.161243Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### OTHER TURQUOISE","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"colour_group_name == 'Other Turquoise'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:27.165602Z","iopub.execute_input":"2022-02-08T14:49:27.166638Z","iopub.status.idle":"2022-02-08T14:49:28.921925Z","shell.execute_reply.started":"2022-02-08T14:49:27.166582Z","shell.execute_reply":"2022-02-08T14:49:28.921138Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### GOLD","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"colour_group_name == 'Gold'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:28.923288Z","iopub.execute_input":"2022-02-08T14:49:28.923764Z","iopub.status.idle":"2022-02-08T14:49:31.259091Z","shell.execute_reply.started":"2022-02-08T14:49:28.923718Z","shell.execute_reply":"2022-02-08T14:49:31.258128Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### BUT WHAT ABOUT ... GREEN PLACEMENT PRINT SWIMWEAR","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"graphical_appearance_name == 'Placement print' \\\n                                        and product_group_name == 'Swimwear' \\\n                                        and colour_group_name == 'Green'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:31.260402Z","iopub.execute_input":"2022-02-08T14:49:31.261084Z","iopub.status.idle":"2022-02-08T14:49:33.018198Z","shell.execute_reply.started":"2022-02-08T14:49:31.261044Z","shell.execute_reply":"2022-02-08T14:49:33.017447Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### D. PERCEIVED COLOUR VALUE NAME","metadata":{}},{"cell_type":"code","source":"s = articles.perceived_colour_value_name.value_counts()\ns_len = s / len(articles.index) * 100\n\nres = pd.concat([s, s_len], axis=1)\\\n        .set_axis(['TOP 10 - Colour Group Name', '%'], axis=1, inplace=False)\n\nres","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T14:49:33.019397Z","iopub.execute_input":"2022-02-08T14:49:33.019924Z","iopub.status.idle":"2022-02-08T14:49:33.050625Z","shell.execute_reply.started":"2022-02-08T14:49:33.019887Z","shell.execute_reply":"2022-02-08T14:49:33.049797Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_distribution('perceived_colour_value_name', articles, 'Perceived Colour Value Name')","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T14:49:33.052160Z","iopub.execute_input":"2022-02-08T14:49:33.053245Z","iopub.status.idle":"2022-02-08T14:49:34.139359Z","shell.execute_reply.started":"2022-02-08T14:49:33.053194Z","shell.execute_reply":"2022-02-08T14:49:34.137994Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### MEDIUM DUSTY","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"perceived_colour_value_name == 'Medium Dusty'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:34.140737Z","iopub.execute_input":"2022-02-08T14:49:34.141113Z","iopub.status.idle":"2022-02-08T14:49:35.740313Z","shell.execute_reply.started":"2022-02-08T14:49:34.141076Z","shell.execute_reply":"2022-02-08T14:49:35.737899Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### DARK","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"perceived_colour_value_name == 'Dark'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:35.741829Z","iopub.execute_input":"2022-02-08T14:49:35.743085Z","iopub.status.idle":"2022-02-08T14:49:37.506798Z","shell.execute_reply.started":"2022-02-08T14:49:35.743016Z","shell.execute_reply":"2022-02-08T14:49:37.506152Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### E. PERCIVED COLOUR MASTER NAME","metadata":{}},{"cell_type":"code","source":"s = articles.perceived_colour_master_name.value_counts()\ns_len = s / len(articles.index) * 100\n\nres = pd.concat([s, s_len], axis=1)\\\n        .set_axis(['TOP 10 - Perceived Colour Master Name', '%'], axis=1, inplace=False)\n\nres","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T14:49:37.507957Z","iopub.execute_input":"2022-02-08T14:49:37.508308Z","iopub.status.idle":"2022-02-08T14:49:37.539750Z","shell.execute_reply.started":"2022-02-08T14:49:37.508260Z","shell.execute_reply":"2022-02-08T14:49:37.539069Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### BLUE","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"perceived_colour_master_name == 'Blue'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:37.540783Z","iopub.execute_input":"2022-02-08T14:49:37.541668Z","iopub.status.idle":"2022-02-08T14:49:39.749640Z","shell.execute_reply.started":"2022-02-08T14:49:37.541631Z","shell.execute_reply":"2022-02-08T14:49:39.748676Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### METAL","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"perceived_colour_master_name == 'Metal'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:39.751119Z","iopub.execute_input":"2022-02-08T14:49:39.751612Z","iopub.status.idle":"2022-02-08T14:49:42.209892Z","shell.execute_reply.started":"2022-02-08T14:49:39.751576Z","shell.execute_reply":"2022-02-08T14:49:42.208839Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### F. GARMENT GROUP NAME","metadata":{}},{"cell_type":"code","source":"s = articles.garment_group_name.value_counts()\ns_len = s / len(articles.index) * 100\n\nres = pd.concat([s, s_len], axis=1)\\\n        .set_axis(['TOP 10 - Garment Group Name', '%'], axis=1, inplace=False)\n\nres","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T14:49:42.211249Z","iopub.execute_input":"2022-02-08T14:49:42.211473Z","iopub.status.idle":"2022-02-08T14:49:42.244283Z","shell.execute_reply.started":"2022-02-08T14:49:42.211445Z","shell.execute_reply":"2022-02-08T14:49:42.243537Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_distribution('garment_group_name', articles, 'Garement Group Name')","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:42.250085Z","iopub.execute_input":"2022-02-08T14:49:42.251086Z","iopub.status.idle":"2022-02-08T14:49:43.411302Z","shell.execute_reply.started":"2022-02-08T14:49:42.251046Z","shell.execute_reply":"2022-02-08T14:49:43.410332Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### JERSEY BASIC","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"garment_group_name == 'Jersey Basic'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:43.412566Z","iopub.execute_input":"2022-02-08T14:49:43.412815Z","iopub.status.idle":"2022-02-08T14:49:45.377689Z","shell.execute_reply.started":"2022-02-08T14:49:43.412764Z","shell.execute_reply":"2022-02-08T14:49:45.376859Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### OUTDOOR","metadata":{}},{"cell_type":"code","source":"disply_multiple_img_ids(articles.query(\"garment_group_name == 'Outdoor'\").article_id[:5], 1, 5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:45.379059Z","iopub.execute_input":"2022-02-08T14:49:45.379295Z","iopub.status.idle":"2022-02-08T14:49:47.286727Z","shell.execute_reply.started":"2022-02-08T14:49:45.379265Z","shell.execute_reply":"2022-02-08T14:49:47.285866Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### LET'S LOOK INTO ARTICLE DESCRIPTION\n\n#### SHOW 10 PRODUCT DESCRIPTION","metadata":{}},{"cell_type":"code","source":"HTML(pd.DataFrame(articles.detail_desc.sample(10)).to_html())","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:47.288406Z","iopub.execute_input":"2022-02-08T14:49:47.289389Z","iopub.status.idle":"2022-02-08T14:49:47.304727Z","shell.execute_reply.started":"2022-02-08T14:49:47.289336Z","shell.execute_reply":"2022-02-08T14:49:47.303886Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### SHOW MOST COMMON WORDS IN DESCRIPTION","metadata":{}},{"cell_type":"code","source":"prod_desc = articles[articles.detail_desc.notnull()].detail_desc.sample(5000).values","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:47.306161Z","iopub.execute_input":"2022-02-08T14:49:47.306403Z","iopub.status.idle":"2022-02-08T14:49:47.355816Z","shell.execute_reply.started":"2022-02-08T14:49:47.306373Z","shell.execute_reply":"2022-02-08T14:49:47.355040Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from wordcloud import WordCloud, STOPWORDS\n\nstopwords = set(STOPWORDS) \nwordcloud = WordCloud(width = 800, \n                      height = 800,\n                      background_color ='white',\n                      min_font_size = 10,\n                      stopwords = stopwords,).generate(' '.join(prod_desc)) \n\n# plot the WordCloud image                        \nplt.figure(figsize = (8, 8), facecolor = None) \nplt.imshow(wordcloud) \nplt.axis(\"off\") \nplt.tight_layout(pad = 0) \n\nplt.show() ","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:47.357314Z","iopub.execute_input":"2022-02-08T14:49:47.358041Z","iopub.status.idle":"2022-02-08T14:49:49.806972Z","shell.execute_reply.started":"2022-02-08T14:49:47.358005Z","shell.execute_reply":"2022-02-08T14:49:49.805907Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### MORE INFORMATION ABOUT ARTICLES DATASET","metadata":{}},{"cell_type":"code","source":"print(f\"Are there any NaN values? {colored(articles.isnull().values.any(), 'yellow')}\")","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:49.808634Z","iopub.execute_input":"2022-02-08T14:49:49.808950Z","iopub.status.idle":"2022-02-08T14:49:49.980053Z","shell.execute_reply.started":"2022-02-08T14:49:49.808910Z","shell.execute_reply":"2022-02-08T14:49:49.978841Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"NaN values dsitribution in ARTICLES dataset: \")\narticles.isnull().sum(axis = 0)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:49.982114Z","iopub.execute_input":"2022-02-08T14:49:49.982471Z","iopub.status.idle":"2022-02-08T14:49:50.158444Z","shell.execute_reply.started":"2022-02-08T14:49:49.982425Z","shell.execute_reply":"2022-02-08T14:49:50.157516Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## B. CUSTOMERS","metadata":{}},{"cell_type":"code","source":"customers.head(5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:50.160104Z","iopub.execute_input":"2022-02-08T14:49:50.160349Z","iopub.status.idle":"2022-02-08T14:49:50.173420Z","shell.execute_reply.started":"2022-02-08T14:49:50.160321Z","shell.execute_reply":"2022-02-08T14:49:50.172485Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"customers.info()","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:50.174948Z","iopub.execute_input":"2022-02-08T14:49:50.175650Z","iopub.status.idle":"2022-02-08T14:49:50.838286Z","shell.execute_reply.started":"2022-02-08T14:49:50.175604Z","shell.execute_reply":"2022-02-08T14:49:50.837293Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"customers.iloc[:, :-1].describe().T.sort_values(by='std' , ascending = False)\\\n                     .style.background_gradient(cmap='GnBu')\\\n                     .bar(subset=[\"max\"], color='#F8766D')\\\n                     .bar(subset=[\"mean\",], color='#00BFC4')","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:50.839670Z","iopub.execute_input":"2022-02-08T14:49:50.839994Z","iopub.status.idle":"2022-02-08T14:49:51.112613Z","shell.execute_reply.started":"2022-02-08T14:49:50.839956Z","shell.execute_reply":"2022-02-08T14:49:51.111820Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_distribution('age', customers, 'Age distribution')","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T14:49:51.113876Z","iopub.execute_input":"2022-02-08T14:49:51.114080Z","iopub.status.idle":"2022-02-08T14:49:57.795815Z","shell.execute_reply.started":"2022-02-08T14:49:51.114056Z","shell.execute_reply":"2022-02-08T14:49:57.795099Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(f\"There are {colored(customers.customer_id.nunique(), 'yellow')} unique customer_id in customers dataset\")\nprint(f\"There are {colored(customers.postal_code.nunique(), 'yellow')} unique postal codes in dataset\")","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:57.796980Z","iopub.execute_input":"2022-02-08T14:49:57.797438Z","iopub.status.idle":"2022-02-08T14:49:59.039089Z","shell.execute_reply.started":"2022-02-08T14:49:57.797407Z","shell.execute_reply":"2022-02-08T14:49:59.038199Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Fasion frequency news for customer in dataset: \")\ncustomers.fashion_news_frequency.value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:49:59.040491Z","iopub.execute_input":"2022-02-08T14:49:59.040834Z","iopub.status.idle":"2022-02-08T14:49:59.261399Z","shell.execute_reply.started":"2022-02-08T14:49:59.040793Z","shell.execute_reply":"2022-02-08T14:49:59.260405Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_distribution('fashion_news_frequency', customers, 'Fasion News Frequency')","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T14:49:59.262419Z","iopub.execute_input":"2022-02-08T14:49:59.262635Z","iopub.status.idle":"2022-02-08T14:50:11.996392Z","shell.execute_reply.started":"2022-02-08T14:49:59.262608Z","shell.execute_reply":"2022-02-08T14:50:11.995797Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Customer status distribution in dataset: \")\ncustomers.club_member_status.value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:50:11.997331Z","iopub.execute_input":"2022-02-08T14:50:11.997528Z","iopub.status.idle":"2022-02-08T14:50:12.226749Z","shell.execute_reply.started":"2022-02-08T14:50:11.997502Z","shell.execute_reply":"2022-02-08T14:50:12.225870Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_distribution('club_member_status', customers, 'Club Member Status')","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-08T14:50:12.228103Z","iopub.execute_input":"2022-02-08T14:50:12.228558Z","iopub.status.idle":"2022-02-08T14:50:24.880387Z","shell.execute_reply.started":"2022-02-08T14:50:12.228521Z","shell.execute_reply":"2022-02-08T14:50:24.878635Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(f\"Are there any NaN values: {customers.isnull().values.any()}\")","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:50:24.883037Z","iopub.execute_input":"2022-02-08T14:50:24.884513Z","iopub.status.idle":"2022-02-08T14:50:25.546289Z","shell.execute_reply.started":"2022-02-08T14:50:24.884452Z","shell.execute_reply":"2022-02-08T14:50:25.545103Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"NaN values dsitribution in CUSTOMER dataset: \")\ncustomers.isnull().sum(axis = 0)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:50:25.547732Z","iopub.execute_input":"2022-02-08T14:50:25.547975Z","iopub.status.idle":"2022-02-08T14:50:26.195855Z","shell.execute_reply.started":"2022-02-08T14:50:25.547946Z","shell.execute_reply":"2022-02-08T14:50:26.194776Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(f\"How many duplicates we have in customer dataset? {colored(customers.duplicated().sum(), 'yellow')}\\n\")\ncustomers[customers.duplicated()]","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:50:26.197272Z","iopub.execute_input":"2022-02-08T14:50:26.197662Z","iopub.status.idle":"2022-02-08T14:50:29.506821Z","shell.execute_reply.started":"2022-02-08T14:50:26.197626Z","shell.execute_reply":"2022-02-08T14:50:29.505793Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## C. TRANSACTIONS","metadata":{}},{"cell_type":"code","source":"transactions.head(5)","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:50:29.508557Z","iopub.execute_input":"2022-02-08T14:50:29.509251Z","iopub.status.idle":"2022-02-08T14:50:29.521086Z","shell.execute_reply.started":"2022-02-08T14:50:29.509199Z","shell.execute_reply":"2022-02-08T14:50:29.520049Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"transactions.info()","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:50:29.522983Z","iopub.execute_input":"2022-02-08T14:50:29.523293Z","iopub.status.idle":"2022-02-08T14:50:29.540416Z","shell.execute_reply.started":"2022-02-08T14:50:29.523251Z","shell.execute_reply":"2022-02-08T14:50:29.539285Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"transactions.iloc[:, :-1].describe().T.sort_values(by='std' , ascending = False)\\\n                     .style.background_gradient(cmap='GnBu')\\\n                     .bar(subset=[\"max\"], color='#F8766D')\\\n                     .bar(subset=[\"mean\",], color='#00BFC4')","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:50:29.541992Z","iopub.execute_input":"2022-02-08T14:50:29.542462Z","iopub.status.idle":"2022-02-08T14:50:33.331657Z","shell.execute_reply.started":"2022-02-08T14:50:29.542429Z","shell.execute_reply":"2022-02-08T14:50:33.330867Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(f\"There are {colored(transactions.customer_id.nunique(), 'yellow')} unique customer_id in dataset\")\nprint(f\"There are {colored(transactions.article_id.nunique(), 'yellow')} unique articles_id in dataset\")\nprint(f\"There are {colored(transactions.sales_channel_id.nunique(), 'yellow')} unique sales_channel_id in dataset\")","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:50:33.333108Z","iopub.execute_input":"2022-02-08T14:50:33.333711Z","iopub.status.idle":"2022-02-08T14:50:42.575579Z","shell.execute_reply.started":"2022-02-08T14:50:33.333665Z","shell.execute_reply":"2022-02-08T14:50:42.574713Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Channel transaction distribution\")\ntransactions.sales_channel_id.value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:50:42.576969Z","iopub.execute_input":"2022-02-08T14:50:42.577206Z","iopub.status.idle":"2022-02-08T14:50:42.753320Z","shell.execute_reply.started":"2022-02-08T14:50:42.577175Z","shell.execute_reply":"2022-02-08T14:50:42.752464Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(f\"Are there any NaN values? {colored(transactions.isnull().values.any(), 'yellow')}\")","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:50:42.754677Z","iopub.execute_input":"2022-02-08T14:50:42.755886Z","iopub.status.idle":"2022-02-08T14:50:49.604976Z","shell.execute_reply.started":"2022-02-08T14:50:42.755850Z","shell.execute_reply":"2022-02-08T14:50:49.603857Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(f\"How many duplicates we have in transactions dataset? {colored(transactions.duplicated().sum(), 'yellow')}\\n\")\ntransactions[transactions.duplicated()][:10]","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:50:49.606297Z","iopub.execute_input":"2022-02-08T14:50:49.607293Z","iopub.status.idle":"2022-02-08T14:51:33.989774Z","shell.execute_reply.started":"2022-02-08T14:50:49.607246Z","shell.execute_reply":"2022-02-08T14:51:33.988717Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## IMAGES DATASET","metadata":{}},{"cell_type":"code","source":"print(f\"There are {colored(len(images_path), 'yellow')} number of images in dataset\")\nprint(f\"They are grouped into {colored(len(cat_images), 'yellow')} categories\")","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:51:33.991072Z","iopub.execute_input":"2022-02-08T14:51:33.991281Z","iopub.status.idle":"2022-02-08T14:51:33.997276Z","shell.execute_reply.started":"2022-02-08T14:51:33.991255Z","shell.execute_reply":"2022-02-08T14:51:33.996201Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### IMAGE RESOLUTON DISTRIBUTION (TOP10) - FOR 1000 IMAGES (DATASET CONTAINS OF 105100 IMAGES)","metadata":{}},{"cell_type":"code","source":"count = 0\nimg_shapes = []\nfor img in images_path:\n    image = cv2.imread(img)\n    img_shapes.append(image.shape)\n    count += 1\n    \n    if count > 1000:\n        break\n\ndf_img_shapes = pd.DataFrame({'Shapes': img_shapes})\nimg_shape_counts = df_img_shapes['Shapes'].value_counts().head(10)\n\nfor i in range(len(img_shape_counts)):\n    print(\"Shape %s counts: %d\" % (img_shape_counts.index[i], img_shape_counts.values[i]))","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:51:33.998849Z","iopub.execute_input":"2022-02-08T14:51:33.999115Z","iopub.status.idle":"2022-02-08T14:52:14.498638Z","shell.execute_reply.started":"2022-02-08T14:51:33.999085Z","shell.execute_reply":"2022-02-08T14:52:14.497758Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(14, 10))\nsns.barplot(x = img_shape_counts.index, y = img_shape_counts.values)\nplt.title(\"Images Dataset\")\n\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-02-08T14:52:14.499948Z","iopub.execute_input":"2022-02-08T14:52:14.500207Z","iopub.status.idle":"2022-02-08T14:52:14.772887Z","shell.execute_reply.started":"2022-02-08T14:52:14.500179Z","shell.execute_reply":"2022-02-08T14:52:14.771858Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## WORK IN PROGRESS ...","metadata":{}}]}