{"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":"<div style=\"text-align: center\"><h1><font size='10' face = \"Amperserif\" color=\"#FF0540\"> <em>H&M</em> 👠 Fashion Recommendation <br> 👗 🥻 🤔 </font></h1></div>","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nimport plotly.express as px\nimport plotly.graph_objects as go\nfrom skimage import io\nfrom skimage.color import gray2rgb\nfrom skimage.transform import resize\nfrom rich.jupyter import print\nimport os\nimport sys\nfrom rich.columns import Columns\nfrom rich.panel import Panel\nimport textwrap\n\nseed = 400 # dont forget to change this when exploring!","metadata":{"execution":{"iopub.status.busy":"2022-02-17T09:45:24.716318Z","iopub.execute_input":"2022-02-17T09:45:24.717008Z","iopub.status.idle":"2022-02-17T09:45:27.546240Z","shell.execute_reply.started":"2022-02-17T09:45:24.716902Z","shell.execute_reply":"2022-02-17T09:45:27.545475Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\n# load all CSVs\ndata_path = \"/kaggle/input/h-and-m-personalized-fashion-recommendations/\"\narticles_df = pd.read_csv(data_path + \"articles.csv\")\ncustomers_df = pd.read_csv(data_path + \"customers.csv\")\ntransactions_df = pd.read_csv(data_path + \"transactions_train.csv\")\nsubmission_df = pd.read_csv(data_path + \"sample_submission.csv\")","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-17T09:45:27.548710Z","iopub.execute_input":"2022-02-17T09:45:27.549418Z","iopub.status.idle":"2022-02-17T09:46:41.332426Z","shell.execute_reply.started":"2022-02-17T09:45:27.549380Z","shell.execute_reply":"2022-02-17T09:46:41.331700Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 📦 Articles","metadata":{}},{"cell_type":"code","source":"# print an example of all attributes\nsample_article = articles_df.sample(1, random_state=seed)\npanels = [Panel(f\"[#4743EF] {textwrap.fill(key, 27)} \\n [#C020D0]{val[0]}\", padding=0) for key, val in sample_article.to_dict(orient='list').items()]\nprint(Columns(panels, expand=True, width=30, title=f'[b][blue] Examples of all article attributes'))","metadata":{"_kg_hide-input":false,"execution":{"iopub.status.busy":"2022-02-17T09:46:41.346567Z","iopub.execute_input":"2022-02-17T09:46:41.347110Z","iopub.status.idle":"2022-02-17T09:46:41.385740Z","shell.execute_reply.started":"2022-02-17T09:46:41.347074Z","shell.execute_reply":"2022-02-17T09:46:41.385072Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\n    \"[bold red] Some main stats, in a general hierarchy you may find on the website\", \"\\n\",\n    \"[blue] 🌟 Total index groups [~Menswear]\", articles_df.index_group_name.nunique(), \"\\n\",\n    \"[blue] 🌟 Total departments [~Shoes]\", articles_df.department_name.nunique(), \"\\n\",\n    \"[blue] 🌟 Groups and Subgroups[Shoes -> Sneakers]\", articles_df.product_group_name.nunique(), articles_df.product_type_name.nunique(), \"\\n\",\n    \"[blue] 🌟 Unique products\", articles_df.prod_name.nunique(), \"\\n\",\n    \"[blue] 🌟 Total articles\", articles_df.article_id.nunique(), \"\\n\",\n    \"[blue] 🌟 Total possible attributes\", len(articles_df.columns.values))\n\nprint(\"[bold red] All stats\")\n# check the stats\narticles_df.describe(include='all')","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-02-17T09:55:27.431904Z","iopub.execute_input":"2022-02-17T09:55:27.432241Z","iopub.status.idle":"2022-02-17T09:55:27.795233Z","shell.execute_reply.started":"2022-02-17T09:55:27.432204Z","shell.execute_reply":"2022-02-17T09:55:27.794481Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div class=\"alert alert-block alert-warning\"> \n🚧 👷🏻‍♂️ work in progress!\n</div>","metadata":{}}]}