{"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":"# Importing nessesasry libraries","metadata":{"papermill":{"duration":0.062966,"end_time":"2022-02-11T12:08:54.835543","exception":false,"start_time":"2022-02-11T12:08:54.772577","status":"completed"},"tags":[]}},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport os\nfrom tqdm import tqdm\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nfrom wordcloud import WordCloud, STOPWORDS\nfrom PIL import Image","metadata":{"_kg_hide-input":true,"papermill":{"duration":1.094661,"end_time":"2022-02-11T12:08:55.993839","exception":false,"start_time":"2022-02-11T12:08:54.899178","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:55:54.571706Z","iopub.execute_input":"2022-02-11T13:55:54.572076Z","iopub.status.idle":"2022-02-11T13:55:55.481679Z","shell.execute_reply.started":"2022-02-11T13:55:54.571957Z","shell.execute_reply":"2022-02-11T13:55:55.480810Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# data directory and overview","metadata":{"papermill":{"duration":0.063182,"end_time":"2022-02-11T12:08:56.122115","exception":false,"start_time":"2022-02-11T12:08:56.058933","status":"completed"},"tags":[]}},{"cell_type":"code","source":"print(f\"folders: {os.listdir('/kaggle/input/h-and-m-personalized-fashion-recommendations/')}\")\nprint(\"subfolders: \", len(list(os.listdir(\"/kaggle/input/h-and-m-personalized-fashion-recommendations/images\"))))","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.087678,"end_time":"2022-02-11T12:08:56.273237","exception":false,"start_time":"2022-02-11T12:08:56.185559","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:55:55.483562Z","iopub.execute_input":"2022-02-11T13:55:55.484092Z","iopub.status.idle":"2022-02-11T13:55:55.501185Z","shell.execute_reply.started":"2022-02-11T13:55:55.484049Z","shell.execute_reply":"2022-02-11T13:55:55.500461Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"total_folders = total_files = 0\nfolder_info = []\nimages_names = []\nfor base, dirs, files in tqdm(os.walk('/kaggle/input/h-and-m-personalized-fashion-recommendations/')):\n    for directories in dirs:\n        folder_info.append((directories, len(os.listdir(os.path.join(base, directories)))))\n        total_folders += 1\n    for _files in files:\n        total_files += 1\n        if len(_files.split(\".jpg\"))==2:\n            images_names.append(_files.split(\".jpg\")[0])","metadata":{"_kg_hide-input":true,"papermill":{"duration":52.190503,"end_time":"2022-02-11T12:09:48.52881","exception":false,"start_time":"2022-02-11T12:08:56.338307","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:55:55.502468Z","iopub.execute_input":"2022-02-11T13:55:55.502863Z","iopub.status.idle":"2022-02-11T13:56:23.013893Z","shell.execute_reply.started":"2022-02-11T13:55:55.502821Z","shell.execute_reply":"2022-02-11T13:56:23.013039Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(f\"Total number of folders: {total_folders}\\nTotal number of files: {total_files}\")\nfolder_info_df = pd.DataFrame(folder_info, columns=[\"folder\", \"files count\"])\nfolder_info_df.sort_values([\"files count\"], ascending=False).head()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.110149,"end_time":"2022-02-11T12:09:48.719749","exception":false,"start_time":"2022-02-11T12:09:48.6096","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:56:23.016492Z","iopub.execute_input":"2022-02-11T13:56:23.016951Z","iopub.status.idle":"2022-02-11T13:56:23.046652Z","shell.execute_reply.started":"2022-02-11T13:56:23.016906Z","shell.execute_reply":"2022-02-11T13:56:23.045861Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"folder names: \", list(folder_info_df.folder.unique()))","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.093485,"end_time":"2022-02-11T12:09:48.89503","exception":false,"start_time":"2022-02-11T12:09:48.801545","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:56:23.055497Z","iopub.execute_input":"2022-02-11T13:56:23.055978Z","iopub.status.idle":"2022-02-11T13:56:23.063192Z","shell.execute_reply.started":"2022-02-11T13:56:23.055932Z","shell.execute_reply":"2022-02-11T13:56:23.062411Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Checking the available files format","metadata":{}},{"cell_type":"code","source":"articles_df = pd.read_csv(\"/kaggle/input/h-and-m-personalized-fashion-recommendations/articles.csv\")\ncustomers_df = pd.read_csv(\"/kaggle/input/h-and-m-personalized-fashion-recommendations/customers.csv\")\nsample_submission_df = pd.read_csv(\"/kaggle/input/h-and-m-personalized-fashion-recommendations/sample_submission.csv\")","metadata":{"_kg_hide-input":true,"papermill":{"duration":12.700481,"end_time":"2022-02-11T12:10:01.677807","exception":false,"start_time":"2022-02-11T12:09:48.977326","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:56:23.064220Z","iopub.execute_input":"2022-02-11T13:56:23.064565Z","iopub.status.idle":"2022-02-11T13:56:34.015439Z","shell.execute_reply.started":"2022-02-11T13:56:23.064515Z","shell.execute_reply":"2022-02-11T13:56:34.014560Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"transactions_train_df = pd.read_csv(\"/kaggle/input/h-and-m-personalized-fashion-recommendations/transactions_train.csv\")","metadata":{"_kg_hide-input":true,"papermill":{"duration":67.683002,"end_time":"2022-02-11T12:11:09.44299","exception":false,"start_time":"2022-02-11T12:10:01.759988","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:56:34.018452Z","iopub.execute_input":"2022-02-11T13:56:34.018700Z","iopub.status.idle":"2022-02-11T13:57:44.640096Z","shell.execute_reply.started":"2022-02-11T13:56:34.018671Z","shell.execute_reply":"2022-02-11T13:57:44.639188Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"articles_df.head()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.12335,"end_time":"2022-02-11T12:11:09.647839","exception":false,"start_time":"2022-02-11T12:11:09.524489","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:44.641523Z","iopub.execute_input":"2022-02-11T13:57:44.641797Z","iopub.status.idle":"2022-02-11T13:57:44.665605Z","shell.execute_reply.started":"2022-02-11T13:57:44.641767Z","shell.execute_reply":"2022-02-11T13:57:44.664851Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"customers_df.head()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.098906,"end_time":"2022-02-11T12:11:09.829327","exception":false,"start_time":"2022-02-11T12:11:09.730421","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:44.678921Z","iopub.execute_input":"2022-02-11T13:57:44.679634Z","iopub.status.idle":"2022-02-11T13:57:44.692968Z","shell.execute_reply.started":"2022-02-11T13:57:44.679597Z","shell.execute_reply":"2022-02-11T13:57:44.692081Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission_df.head()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.09448,"end_time":"2022-02-11T12:11:10.006595","exception":false,"start_time":"2022-02-11T12:11:09.912115","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:44.693906Z","iopub.execute_input":"2022-02-11T13:57:44.694156Z","iopub.status.idle":"2022-02-11T13:57:44.708443Z","shell.execute_reply.started":"2022-02-11T13:57:44.694129Z","shell.execute_reply":"2022-02-11T13:57:44.707927Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"transactions_train_df.head()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.096909,"end_time":"2022-02-11T12:11:10.187726","exception":false,"start_time":"2022-02-11T12:11:10.090817","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:44.709447Z","iopub.execute_input":"2022-02-11T13:57:44.710014Z","iopub.status.idle":"2022-02-11T13:57:44.723078Z","shell.execute_reply.started":"2022-02-11T13:57:44.709950Z","shell.execute_reply":"2022-02-11T13:57:44.722510Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"articles_df.info()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.267602,"end_time":"2022-02-11T12:11:10.539132","exception":false,"start_time":"2022-02-11T12:11:10.27153","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:44.724140Z","iopub.execute_input":"2022-02-11T13:57:44.724353Z","iopub.status.idle":"2022-02-11T13:57:44.897691Z","shell.execute_reply.started":"2022-02-11T13:57:44.724328Z","shell.execute_reply":"2022-02-11T13:57:44.896752Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"customers_df.info()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.716318,"end_time":"2022-02-11T12:11:11.339692","exception":false,"start_time":"2022-02-11T12:11:10.623374","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:44.898982Z","iopub.execute_input":"2022-02-11T13:57:44.899736Z","iopub.status.idle":"2022-02-11T13:57:45.499561Z","shell.execute_reply.started":"2022-02-11T13:57:44.899701Z","shell.execute_reply":"2022-02-11T13:57:45.498763Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission_df.info()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.389933,"end_time":"2022-02-11T12:11:11.814348","exception":false,"start_time":"2022-02-11T12:11:11.424415","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:45.500462Z","iopub.execute_input":"2022-02-11T13:57:45.500657Z","iopub.status.idle":"2022-02-11T13:57:45.800406Z","shell.execute_reply.started":"2022-02-11T13:57:45.500633Z","shell.execute_reply":"2022-02-11T13:57:45.799588Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"transactions_train_df.info()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.097011,"end_time":"2022-02-11T12:11:11.996149","exception":false,"start_time":"2022-02-11T12:11:11.899138","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:45.801597Z","iopub.execute_input":"2022-02-11T13:57:45.801890Z","iopub.status.idle":"2022-02-11T13:57:45.810598Z","shell.execute_reply.started":"2022-02-11T13:57:45.801859Z","shell.execute_reply":"2022-02-11T13:57:45.809842Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# EDA\n\nThere are 3 main tables:\n- articles - contains informations about each article (like product code, name, product group code, name ...)    \n- customers - contains informations about each customer (fidelity card membership, age, postal code)\n- transactions (train)  \n\nTransactions have `customer_id` and `article_id`, which are foreign keys for the customer and articles tables.\nBeside this, transaction also contains `sales_channel_id`.\n","metadata":{"papermill":{"duration":0.085863,"end_time":"2022-02-11T12:11:12.168142","exception":false,"start_time":"2022-02-11T12:11:12.082279","status":"completed"},"tags":[]}},{"cell_type":"code","source":"temp = articles_df.groupby([\"product_group_name\"])[\"product_type_name\"].nunique()\ndf = pd.DataFrame({'Product Group': temp.index,\n                   'Product Types': temp.values\n                  })\ndf = df.sort_values(['Product Types'], ascending=False)\nplt.figure(figsize = (8,6))\nplt.title('Number of Product Types per each Product Group')\nsns.set_color_codes(\"pastel\")\ns = sns.barplot(x = 'Product Group', y=\"Product Types\", data=df)\ns.set_xticklabels(s.get_xticklabels(),rotation=90)\nlocs, labels = plt.xticks()\nplt.show()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.473133,"end_time":"2022-02-11T12:11:12.726541","exception":false,"start_time":"2022-02-11T12:11:12.253408","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:45.811650Z","iopub.execute_input":"2022-02-11T13:57:45.811857Z","iopub.status.idle":"2022-02-11T13:57:46.188648Z","shell.execute_reply.started":"2022-02-11T13:57:45.811831Z","shell.execute_reply":"2022-02-11T13:57:46.187920Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = articles_df.groupby([\"product_group_name\"])[\"article_id\"].nunique()\ndf = pd.DataFrame({'Product Group': temp.index,\n                   'Articles': temp.values\n                  })\ndf = df.sort_values(['Articles'], ascending=False)\nplt.figure(figsize = (8,6))\nplt.title('Number of Articles per each Product Group')\nsns.set_color_codes(\"pastel\")\ns = sns.barplot(x = 'Product Group', y=\"Articles\", data=df)\ns.set_xticklabels(s.get_xticklabels(),rotation=90)\nlocs, labels = plt.xticks()\nplt.show()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.441506,"end_time":"2022-02-11T12:11:13.256124","exception":false,"start_time":"2022-02-11T12:11:12.814618","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:46.189740Z","iopub.execute_input":"2022-02-11T13:57:46.189924Z","iopub.status.idle":"2022-02-11T13:57:46.530097Z","shell.execute_reply.started":"2022-02-11T13:57:46.189901Z","shell.execute_reply":"2022-02-11T13:57:46.529240Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = articles_df.groupby([\"product_type_name\"])[\"article_id\"].nunique()\ndf = pd.DataFrame({'Product Type': temp.index,\n                   'Articles': temp.values\n                  })\ntotal_types = len(df['Product Type'].unique())\ndf = df.sort_values(['Articles'], ascending=False)[0:50]\nplt.figure(figsize = (16,6))\nplt.title(f'Number of Articles per each Product Type (top 50 from total: {total_types})')\nsns.set_color_codes(\"pastel\")\ns = sns.barplot(x = 'Product Type', y=\"Articles\", data=df)\ns.set_xticklabels(s.get_xticklabels(),rotation=90)\nlocs, labels = plt.xticks()\nplt.show()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.961131,"end_time":"2022-02-11T12:11:14.308042","exception":false,"start_time":"2022-02-11T12:11:13.346911","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:46.531345Z","iopub.execute_input":"2022-02-11T13:57:46.532013Z","iopub.status.idle":"2022-02-11T13:57:47.360861Z","shell.execute_reply.started":"2022-02-11T13:57:46.531980Z","shell.execute_reply":"2022-02-11T13:57:47.360070Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = articles_df.groupby([\"department_name\"])[\"article_id\"].nunique()\ndf = pd.DataFrame({'Department Name': temp.index,\n                   'Articles': temp.values\n                  })\ntotal_depts = len(df['Department Name'].unique())\ndf = df.sort_values(['Articles'], ascending=False).head(50)\nplt.figure(figsize = (16,6))\nplt.title(f'Number of Articles per each Department (top 50 from total: {total_depts})')\nsns.set_color_codes(\"pastel\")\ns = sns.barplot(x = 'Department Name', y=\"Articles\", data=df)\ns.set_xticklabels(s.get_xticklabels(),rotation=90)\nlocs, labels = plt.xticks()\nplt.show()","metadata":{"_kg_hide-input":true,"papermill":{"duration":1.149852,"end_time":"2022-02-11T12:11:15.549834","exception":false,"start_time":"2022-02-11T12:11:14.399982","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:47.362143Z","iopub.execute_input":"2022-02-11T13:57:47.362353Z","iopub.status.idle":"2022-02-11T13:57:48.374915Z","shell.execute_reply.started":"2022-02-11T13:57:47.362327Z","shell.execute_reply":"2022-02-11T13:57:48.374168Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = articles_df.groupby([\"index_group_name\"])[\"article_id\"].nunique()\ndf = pd.DataFrame({'Index Group Name': temp.index,\n                   'Articles': temp.values\n                  })\ndf = df.sort_values(['Articles'], ascending=False)\nplt.figure(figsize = (6,6))\nplt.title(f'Number of Articles per each Index Group Name')\nsns.set_color_codes(\"pastel\")\ns = sns.barplot(x = 'Index Group Name', y=\"Articles\", data=df)\ns.set_xticklabels(s.get_xticklabels(),rotation=90)\nlocs, labels = plt.xticks()\nplt.show()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.324028,"end_time":"2022-02-11T12:11:15.967862","exception":false,"start_time":"2022-02-11T12:11:15.643834","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:48.375908Z","iopub.execute_input":"2022-02-11T13:57:48.376125Z","iopub.status.idle":"2022-02-11T13:57:48.591695Z","shell.execute_reply.started":"2022-02-11T13:57:48.376099Z","shell.execute_reply":"2022-02-11T13:57:48.590836Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = articles_df.groupby([\"index_name\"])[\"article_id\"].nunique()\ndf = pd.DataFrame({'Index Name': temp.index,\n                   'Articles': temp.values\n                  })\ndf = df.sort_values(['Articles'], ascending=False)\nplt.figure(figsize = (8,6))\nplt.title(f'Number of Articles per each Index Name')\nsns.set_color_codes(\"pastel\")\ns = sns.barplot(x = 'Index Name', y=\"Articles\", data=df)\ns.set_xticklabels(s.get_xticklabels(),rotation=90)\nlocs, labels = plt.xticks()\nplt.show()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.370013,"end_time":"2022-02-11T12:11:16.431115","exception":false,"start_time":"2022-02-11T12:11:16.061102","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:48.592696Z","iopub.execute_input":"2022-02-11T13:57:48.592873Z","iopub.status.idle":"2022-02-11T13:57:48.873004Z","shell.execute_reply.started":"2022-02-11T13:57:48.592851Z","shell.execute_reply":"2022-02-11T13:57:48.872143Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = articles_df.groupby([\"garment_group_name\"])[\"article_id\"].nunique()\ndf = pd.DataFrame({'Garment Group Name': temp.index,\n                   'Articles': temp.values\n                  })\ndf = df.sort_values(['Articles'], ascending=False)\nplt.figure(figsize = (12,6))\nplt.title(f'Number of Articles per each Garment Group Name')\nsns.set_color_codes(\"pastel\")\ns = sns.barplot(x = 'Garment Group Name', y=\"Articles\", data=df)\ns.set_xticklabels(s.get_xticklabels(),rotation=90)\nlocs, labels = plt.xticks()\nplt.show()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.458764,"end_time":"2022-02-11T12:11:16.985244","exception":false,"start_time":"2022-02-11T12:11:16.52648","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:48.874338Z","iopub.execute_input":"2022-02-11T13:57:48.875003Z","iopub.status.idle":"2022-02-11T13:57:49.232771Z","shell.execute_reply.started":"2022-02-11T13:57:48.874954Z","shell.execute_reply":"2022-02-11T13:57:49.231926Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = articles_df.groupby([\"section_name\"])[\"article_id\"].nunique()\ndf = pd.DataFrame({'Section Name': temp.index,\n                   'Articles': temp.values\n                  })\ndf = df.sort_values(['Articles'], ascending=False)\nplt.figure(figsize = (16,6))\nplt.title(f'Number of Articles per each Section Name')\nsns.set_color_codes(\"pastel\")\ns = sns.barplot(x = 'Section Name', y=\"Articles\", data=df)\ns.set_xticklabels(s.get_xticklabels(),rotation=90)\nlocs, labels = plt.xticks()\nplt.show()","metadata":{"_kg_hide-input":true,"papermill":{"duration":1.218944,"end_time":"2022-02-11T12:11:18.300665","exception":false,"start_time":"2022-02-11T12:11:17.081721","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:49.234133Z","iopub.execute_input":"2022-02-11T13:57:49.234850Z","iopub.status.idle":"2022-02-11T13:57:50.291330Z","shell.execute_reply.started":"2022-02-11T13:57:49.234789Z","shell.execute_reply":"2022-02-11T13:57:50.290765Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"stopwords = set(STOPWORDS)\n\ndef show_wordcloud(data, title = None):\n    wordcloud = WordCloud(\n        background_color='white',\n        stopwords=stopwords,\n        max_words=200,\n        max_font_size=40, \n        scale=5,\n        random_state=1\n    ).generate(str(data))\n\n    fig = plt.figure(1, figsize=(10,10))\n    plt.axis('off')\n    if title: \n        fig.suptitle(title, fontsize=14)\n        fig.subplots_adjust(top=2.3)\n\n    plt.imshow(wordcloud)\n    plt.show()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.109683,"end_time":"2022-02-11T12:11:18.509056","exception":false,"start_time":"2022-02-11T12:11:18.399373","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:50.292264Z","iopub.execute_input":"2022-02-11T13:57:50.292586Z","iopub.status.idle":"2022-02-11T13:57:50.298100Z","shell.execute_reply.started":"2022-02-11T13:57:50.292548Z","shell.execute_reply":"2022-02-11T13:57:50.297529Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"show_wordcloud(articles_df[\"detail_desc\"], \"Wordcloud from detailed description of articles\")","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.913127,"end_time":"2022-02-11T12:11:19.521125","exception":false,"start_time":"2022-02-11T12:11:18.607998","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:50.301710Z","iopub.execute_input":"2022-02-11T13:57:50.302218Z","iopub.status.idle":"2022-02-11T13:57:51.092597Z","shell.execute_reply.started":"2022-02-11T13:57:50.302184Z","shell.execute_reply":"2022-02-11T13:57:51.091619Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = customers_df.groupby([\"age\"])[\"customer_id\"].count()\ndf = pd.DataFrame({'Age': temp.index,\n                   'Customers': temp.values\n                  })\ndf = df.sort_values(['Age'], ascending=False)\nplt.figure(figsize = (16,6))\nplt.title(f'Number of Customers per each Age')\nsns.set_color_codes(\"pastel\")\ns = sns.barplot(x = 'Age', y=\"Customers\", data=df)\ns.set_xticklabels(s.get_xticklabels(),rotation=90)\nlocs, labels = plt.xticks()\nplt.show()","metadata":{"_kg_hide-input":true,"papermill":{"duration":1.40623,"end_time":"2022-02-11T12:11:21.035577","exception":false,"start_time":"2022-02-11T12:11:19.629347","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:51.094262Z","iopub.execute_input":"2022-02-11T13:57:51.094549Z","iopub.status.idle":"2022-02-11T13:57:52.393745Z","shell.execute_reply.started":"2022-02-11T13:57:51.094512Z","shell.execute_reply":"2022-02-11T13:57:52.393189Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = customers_df.groupby([\"fashion_news_frequency\"])[\"customer_id\"].count()\ndf = pd.DataFrame({'Fashion News Frequency': temp.index,\n                   'Customers': temp.values\n                  })\ndf = df.sort_values(['Customers'], ascending=False)\nplt.figure(figsize = (6,6))\nplt.title(f'Number of Customers per each Fashion News Frequency')\nsns.set_color_codes(\"pastel\")\ns = sns.barplot(x = 'Fashion News Frequency', y=\"Customers\", data=df)\ns.set_xticklabels(s.get_xticklabels(),rotation=90)\nlocs, labels = plt.xticks()\nplt.show()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.626762,"end_time":"2022-02-11T12:11:21.766331","exception":false,"start_time":"2022-02-11T12:11:21.139569","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:52.394770Z","iopub.execute_input":"2022-02-11T13:57:52.395089Z","iopub.status.idle":"2022-02-11T13:57:52.899409Z","shell.execute_reply.started":"2022-02-11T13:57:52.395065Z","shell.execute_reply":"2022-02-11T13:57:52.898640Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"temp = customers_df.groupby([\"club_member_status\"])[\"customer_id\"].count()\ndf = pd.DataFrame({'Club Member Status': temp.index,\n                   'Customers': temp.values\n                  })\ndf = df.sort_values(['Customers'], ascending=False)\nplt.figure(figsize = (6,6))\nplt.title(f'Number of Customers per each Club Member Status')\nsns.set_color_codes(\"pastel\")\ns = sns.barplot(x = 'Club Member Status', y=\"Customers\", data=df)\ns.set_xticklabels(s.get_xticklabels(),rotation=90)\nlocs, labels = plt.xticks()\nplt.show()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.62706,"end_time":"2022-02-11T12:11:22.498579","exception":false,"start_time":"2022-02-11T12:11:21.871519","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:52.900823Z","iopub.execute_input":"2022-02-11T13:57:52.901255Z","iopub.status.idle":"2022-02-11T13:57:53.409878Z","shell.execute_reply.started":"2022-02-11T13:57:52.901216Z","shell.execute_reply":"2022-02-11T13:57:53.409154Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"transactions_train_df.sales_channel_id.unique()","metadata":{"papermill":{"duration":0.29157,"end_time":"2022-02-11T12:11:22.898002","exception":false,"start_time":"2022-02-11T12:11:22.606432","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:53.411177Z","iopub.execute_input":"2022-02-11T13:57:53.411840Z","iopub.status.idle":"2022-02-11T13:57:53.589759Z","shell.execute_reply.started":"2022-02-11T13:57:53.411803Z","shell.execute_reply":"2022-02-11T13:57:53.589019Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = transactions_train_df.sample(100_000)\nfig, ax = plt.subplots(1, 1, figsize=(7, 7))\nsns.kdeplot(np.log(df.loc[df[\"sales_channel_id\"]==1].price.value_counts()))\nsns.kdeplot(np.log(df.loc[df[\"sales_channel_id\"]==2].price.value_counts()))\nax.legend(labels=['Sales channel 1', 'Sales channel 1'])\nplt.title(\"Logaritmic distribution of price frequency in transactions, grouped per sales channel (100k sample)\")\nplt.show()","metadata":{"_kg_hide-input":true,"papermill":{"duration":2.361441,"end_time":"2022-02-11T12:11:25.364932","exception":false,"start_time":"2022-02-11T12:11:23.003491","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:53.590893Z","iopub.execute_input":"2022-02-11T13:57:53.591123Z","iopub.status.idle":"2022-02-11T13:57:56.035568Z","shell.execute_reply.started":"2022-02-11T13:57:53.591096Z","shell.execute_reply":"2022-02-11T13:57:56.034737Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Image data\n\nThere are 105542 articles and 105100 different images. Let's check first which articles does not have corresponding images.\n\nThe `article_id` corresponds to digits from 2nd to the last of the image name. \nThe digits from 2nd to 7th of image name  correspond to product code (`product_code`). ","metadata":{"papermill":{"duration":0.108118,"end_time":"2022-02-11T12:11:25.580772","exception":false,"start_time":"2022-02-11T12:11:25.472654","status":"completed"},"tags":[]}},{"cell_type":"code","source":"image_name_df = pd.DataFrame(images_names, columns = [\"image_name\"])\nimage_name_df[\"article_id\"] = image_name_df[\"image_name\"].apply(lambda x: int(x[1:]))","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.217721,"end_time":"2022-02-11T12:11:25.90678","exception":false,"start_time":"2022-02-11T12:11:25.689059","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:56.037121Z","iopub.execute_input":"2022-02-11T13:57:56.037601Z","iopub.status.idle":"2022-02-11T13:57:56.136651Z","shell.execute_reply.started":"2022-02-11T13:57:56.037557Z","shell.execute_reply":"2022-02-11T13:57:56.136025Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"image_name_df.head()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.120842,"end_time":"2022-02-11T12:11:26.135842","exception":false,"start_time":"2022-02-11T12:11:26.015","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:56.137651Z","iopub.execute_input":"2022-02-11T13:57:56.137972Z","iopub.status.idle":"2022-02-11T13:57:56.146535Z","shell.execute_reply.started":"2022-02-11T13:57:56.137935Z","shell.execute_reply":"2022-02-11T13:57:56.145780Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"image_article_df = articles_df[[\"article_id\", \"product_code\", \"product_group_name\", \"product_type_name\"]].merge(image_name_df, on=[\"article_id\"], how=\"left\")\nprint(image_article_df.shape)\nimage_article_df.head()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.171427,"end_time":"2022-02-11T12:11:26.419539","exception":false,"start_time":"2022-02-11T12:11:26.248112","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:56.147677Z","iopub.execute_input":"2022-02-11T13:57:56.148232Z","iopub.status.idle":"2022-02-11T13:57:56.207922Z","shell.execute_reply.started":"2022-02-11T13:57:56.148203Z","shell.execute_reply":"2022-02-11T13:57:56.206826Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Products without images.","metadata":{"papermill":{"duration":0.10873,"end_time":"2022-02-11T12:11:26.64106","exception":false,"start_time":"2022-02-11T12:11:26.53233","status":"completed"},"tags":[]}},{"cell_type":"code","source":"article_no_image_df = image_article_df.loc[image_article_df.image_name.isna()]\nprint(article_no_image_df.shape)\narticle_no_image_df.head()","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.144419,"end_time":"2022-02-11T12:11:26.894845","exception":false,"start_time":"2022-02-11T12:11:26.750426","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:56.209353Z","iopub.execute_input":"2022-02-11T13:57:56.209583Z","iopub.status.idle":"2022-02-11T13:57:56.242353Z","shell.execute_reply.started":"2022-02-11T13:57:56.209554Z","shell.execute_reply":"2022-02-11T13:57:56.241556Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"Product codes without images: \", article_no_image_df.product_code.nunique())\nprint(\"Product group names without images: \", list(article_no_image_df.product_group_name.unique()))","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.120385,"end_time":"2022-02-11T12:11:27.125059","exception":false,"start_time":"2022-02-11T12:11:27.004674","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:56.243610Z","iopub.execute_input":"2022-02-11T13:57:56.243818Z","iopub.status.idle":"2022-02-11T13:57:56.249377Z","shell.execute_reply.started":"2022-02-11T13:57:56.243794Z","shell.execute_reply":"2022-02-11T13:57:56.248807Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Let's visualize few images.","metadata":{"papermill":{"duration":0.109734,"end_time":"2022-02-11T12:11:27.346078","exception":false,"start_time":"2022-02-11T12:11:27.236344","status":"completed"},"tags":[]}},{"cell_type":"code","source":"def plot_image_samples(image_article_df, product_group_name, cols=1, rows=-1):\n    image_path = \"/kaggle/input/h-and-m-personalized-fashion-recommendations/images/\"\n    _df = image_article_df.loc[image_article_df.product_group_name==product_group_name]\n    article_ids = _df.article_id.values[0:cols*rows]\n    plt.figure(figsize=(2 + 3 * cols, 2 + 4 * rows))\n    for i in range(cols * rows):\n        article_id = (\"0\" + str(article_ids[i]))[-10:]\n        plt.subplot(rows, cols, i + 1)\n        plt.axis('off')\n        plt.title(f\"{product_group_name} {article_id[:3]}\\n{article_id}.jpg\")\n        image = Image.open(f\"{image_path}{article_id[:3]}/{article_id}.jpg\")\n        plt.imshow(image)","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.122241,"end_time":"2022-02-11T12:11:27.579752","exception":false,"start_time":"2022-02-11T12:11:27.457511","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:56.250319Z","iopub.execute_input":"2022-02-11T13:57:56.250953Z","iopub.status.idle":"2022-02-11T13:57:56.258867Z","shell.execute_reply.started":"2022-02-11T13:57:56.250925Z","shell.execute_reply":"2022-02-11T13:57:56.258195Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Let's choose from some product group name.","metadata":{"papermill":{"duration":0.109423,"end_time":"2022-02-11T12:11:27.799627","exception":false,"start_time":"2022-02-11T12:11:27.690204","status":"completed"},"tags":[]}},{"cell_type":"code","source":"print(image_article_df.product_group_name.unique())","metadata":{"_kg_hide-input":true,"papermill":{"duration":0.127452,"end_time":"2022-02-11T12:11:28.037612","exception":false,"start_time":"2022-02-11T12:11:27.91016","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:56.260050Z","iopub.execute_input":"2022-02-11T13:57:56.260463Z","iopub.status.idle":"2022-02-11T13:57:56.279919Z","shell.execute_reply.started":"2022-02-11T13:57:56.260431Z","shell.execute_reply":"2022-02-11T13:57:56.278900Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"We will represent images grouped on product group name.","metadata":{"papermill":{"duration":0.11031,"end_time":"2022-02-11T12:11:28.258349","exception":false,"start_time":"2022-02-11T12:11:28.148039","status":"completed"},"tags":[]}},{"cell_type":"code","source":"plot_image_samples(image_article_df, \"Stationery\", 4, 1)","metadata":{"papermill":{"duration":1.715181,"end_time":"2022-02-11T12:11:32.978662","exception":false,"start_time":"2022-02-11T12:11:31.263481","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:56.281233Z","iopub.execute_input":"2022-02-11T13:57:56.281950Z","iopub.status.idle":"2022-02-11T13:57:57.859882Z","shell.execute_reply.started":"2022-02-11T13:57:56.281892Z","shell.execute_reply":"2022-02-11T13:57:57.859290Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_image_samples(image_article_df, \"Fun\", 2, 1)","metadata":{"papermill":{"duration":1.017472,"end_time":"2022-02-11T12:11:34.120248","exception":false,"start_time":"2022-02-11T12:11:33.102776","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-02-11T13:57:57.860833Z","iopub.execute_input":"2022-02-11T13:57:57.861589Z","iopub.status.idle":"2022-02-11T13:57:58.730672Z","shell.execute_reply.started":"2022-02-11T13:57:57.861528Z","shell.execute_reply":"2022-02-11T13:57:58.729773Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Model 1","metadata":{}},{"cell_type":"code","source":"\nfrom pathlib import Path\n\ndata_path = Path('/kaggle/input/h-and-m-personalized-fashion-recommendations/')\ndf = pd.read_csv(\n    data_path / 'transactions_train.csv',\n    # set dtype or pandas will drop the leading '0' and convert to int\n    dtype={'article_id': str} \n)\n","metadata":{"execution":{"iopub.status.busy":"2022-02-11T13:57:58.731844Z","iopub.execute_input":"2022-02-11T13:57:58.732094Z","iopub.status.idle":"2022-02-11T13:58:40.497990Z","shell.execute_reply.started":"2022-02-11T13:57:58.732064Z","shell.execute_reply":"2022-02-11T13:58:40.497236Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(df.shape)\ndf.head()","metadata":{"execution":{"iopub.status.busy":"2022-02-11T13:58:40.499275Z","iopub.execute_input":"2022-02-11T13:58:40.499544Z","iopub.status.idle":"2022-02-11T13:58:40.512193Z","shell.execute_reply.started":"2022-02-11T13:58:40.499515Z","shell.execute_reply":"2022-02-11T13:58:40.511528Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['t_dat'] = pd.to_datetime(df['t_dat'])","metadata":{"execution":{"iopub.status.busy":"2022-02-11T13:58:40.513346Z","iopub.execute_input":"2022-02-11T13:58:40.513901Z","iopub.status.idle":"2022-02-11T13:58:47.327357Z","shell.execute_reply.started":"2022-02-11T13:58:40.513871Z","shell.execute_reply":"2022-02-11T13:58:47.326435Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_3_week = df[df['t_dat'] >= pd.to_datetime('2020-08-31')].copy()\ndf_2_week = df[df['t_dat'] >= pd.to_datetime('2020-09-07')].copy()\ndf_1_week = df[df['t_dat'] >= pd.to_datetime('2020-09-15')].copy()","metadata":{"execution":{"iopub.status.busy":"2022-02-11T13:58:47.328644Z","iopub.execute_input":"2022-02-11T13:58:47.328853Z","iopub.status.idle":"2022-02-11T13:58:47.924712Z","shell.execute_reply.started":"2022-02-11T13:58:47.328828Z","shell.execute_reply":"2022-02-11T13:58:47.923861Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"purchase_dict_3_week= {}\n\nfor i,x in enumerate(zip(df_3_week['customer_id'], df_3_week['article_id'])):\n    cust_id, art_id = x\n    if cust_id not in purchase_dict_3_week:\n        purchase_dict_3_week[cust_id] = {}\n    \n    if art_id not in purchase_dict_3_week[cust_id]:\n        purchase_dict_3_week[cust_id][art_id] = 0\n    \n    purchase_dict_3_week[cust_id][art_id] += 1\n    \nprint(len(purchase_dict_3_week))\n\ndummy_list_3_week = list((df_3_week['article_id'].value_counts()).index)[:12]","metadata":{"execution":{"iopub.status.busy":"2022-02-11T13:58:47.925850Z","iopub.execute_input":"2022-02-11T13:58:47.926202Z","iopub.status.idle":"2022-02-11T13:58:49.255191Z","shell.execute_reply.started":"2022-02-11T13:58:47.926168Z","shell.execute_reply":"2022-02-11T13:58:49.254244Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"purchase_dict_2_week= {}\n\nfor i,x in enumerate(zip(df_2_week['customer_id'], df_2_week['article_id'])):\n    cust_id, art_id = x\n    if cust_id not in purchase_dict_2_week:\n        purchase_dict_2_week[cust_id] = {}\n    \n    if art_id not in purchase_dict_2_week[cust_id]:\n        purchase_dict_2_week[cust_id][art_id] = 0\n    \n    purchase_dict_2_week[cust_id][art_id] += 1\n    \nprint(len(purchase_dict_2_week))\n\ndummy_list_2_week = list((df_2_week['article_id'].value_counts()).index)[:12]","metadata":{"execution":{"iopub.status.busy":"2022-02-11T13:58:49.256622Z","iopub.execute_input":"2022-02-11T13:58:49.256844Z","iopub.status.idle":"2022-02-11T13:58:50.180707Z","shell.execute_reply.started":"2022-02-11T13:58:49.256817Z","shell.execute_reply":"2022-02-11T13:58:50.179749Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"purchase_dict_1_week= {}\n\nfor i,x in enumerate(zip(df_1_week['customer_id'], df_1_week['article_id'])):\n    cust_id, art_id = x\n    if cust_id not in purchase_dict_1_week:\n        purchase_dict_1_week[cust_id] = {}\n    \n    if art_id not in purchase_dict_1_week[cust_id]:\n        purchase_dict_1_week[cust_id][art_id] = 0\n    \n    purchase_dict_1_week[cust_id][art_id] += 1\n    \nprint(len(purchase_dict_1_week))\n\ndummy_list_1_week = list((df_1_week['article_id'].value_counts()).index)[:12]","metadata":{"execution":{"iopub.status.busy":"2022-02-11T13:58:50.182142Z","iopub.execute_input":"2022-02-11T13:58:50.182460Z","iopub.status.idle":"2022-02-11T13:58:50.606581Z","shell.execute_reply.started":"2022-02-11T13:58:50.182405Z","shell.execute_reply":"2022-02-11T13:58:50.605684Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(sample_submission_df.shape)\nsample_submission_df.head()","metadata":{"execution":{"iopub.status.busy":"2022-02-11T13:58:50.607861Z","iopub.execute_input":"2022-02-11T13:58:50.608176Z","iopub.status.idle":"2022-02-11T13:58:50.619850Z","shell.execute_reply.started":"2022-02-11T13:58:50.608135Z","shell.execute_reply":"2022-02-11T13:58:50.618815Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"need_improvemnet_model = sample_submission_df[['customer_id']]\nprediction_list = []\n\ndummy_list = list((df_2_week['article_id'].value_counts()).index)[:12]\ndummy_pred = ' '.join(dummy_list)\n\nfor i, cust_id in enumerate(sample_submission_df['customer_id'].values.reshape((-1,))):\n    if cust_id in purchase_dict_1_week:\n        l = sorted((purchase_dict_1_week[cust_id]).items(), key=lambda x: x[1], reverse=True)\n        l = [y[0] for y in l]\n        if len(l)>12:\n            s = ' '.join(l[:12])\n        else:\n            s = ' '.join(l+dummy_list_1_week[:(12-len(l))])\n    elif cust_id in purchase_dict_2_week:\n        l = sorted((purchase_dict_2_week[cust_id]).items(), key=lambda x: x[1], reverse=True)\n        l = [y[0] for y in l]\n        if len(l)>12:\n            s = ' '.join(l[:12])\n        else:\n            s = ' '.join(l+dummy_list_2_week[:(12-len(l))])\n    elif cust_id in purchase_dict_3_week:\n        l = sorted((purchase_dict_3_week[cust_id]).items(), key=lambda x: x[1], reverse=True)\n        l = [y[0] for y in l]\n        if len(l)>12:\n            s = ' '.join(l[:12])\n        else:\n            s = ' '.join(l+dummy_list_3_week[:(12-len(l))])\n    else:\n        s = dummy_pred\n    prediction_list.append(s)\n\nneed_improvemnet_model['prediction'] = prediction_list\nprint(need_improvemnet_model.shape)\nneed_improvemnet_model.head()\n","metadata":{"execution":{"iopub.status.busy":"2022-02-11T13:58:50.621239Z","iopub.execute_input":"2022-02-11T13:58:50.621532Z","iopub.status.idle":"2022-02-11T13:58:52.968158Z","shell.execute_reply.started":"2022-02-11T13:58:50.621493Z","shell.execute_reply":"2022-02-11T13:58:52.967355Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"need_improvemnet_model.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2022-02-11T13:58:52.969411Z","iopub.execute_input":"2022-02-11T13:58:52.969690Z","iopub.status.idle":"2022-02-11T13:59:05.488717Z","shell.execute_reply.started":"2022-02-11T13:58:52.969652Z","shell.execute_reply":"2022-02-11T13:59:05.488030Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Model 2","metadata":{}}]}