{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)","metadata":{"_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","papermill":{"duration":0.024409,"end_time":"2022-05-19T04:43:01.958045","exception":false,"start_time":"2022-05-19T04:43:01.933636","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-02-04T16:27:25.920641Z","iopub.execute_input":"2023-02-04T16:27:25.921472Z","iopub.status.idle":"2023-02-04T16:27:25.951608Z","shell.execute_reply.started":"2023-02-04T16:27:25.921359Z","shell.execute_reply":"2023-02-04T16:27:25.950370Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('../input/h-and-m-personalized-fashion-recommendations/articles.csv', dtype=str)","metadata":{"papermill":{"duration":1.311706,"end_time":"2022-05-19T04:43:03.278168","exception":false,"start_time":"2022-05-19T04:43:01.966462","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-02-04T16:27:25.953558Z","iopub.execute_input":"2023-02-04T16:27:25.954289Z","iopub.status.idle":"2023-02-04T16:27:27.435665Z","shell.execute_reply.started":"2023-02-04T16:27:25.954233Z","shell.execute_reply":"2023-02-04T16:27:27.434155Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = df[['article_id', 'product_type_name',\n       'product_group_name', \n       'graphical_appearance_name', 'colour_group_name',\n       'perceived_colour_value_name',\n       'perceived_colour_master_name',\n       'department_name', 'index_name',\n       'index_group_name', 'section_name',\n       'garment_group_name']]","metadata":{"papermill":{"duration":0.050048,"end_time":"2022-05-19T04:43:03.335855","exception":false,"start_time":"2022-05-19T04:43:03.285807","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-02-04T16:27:27.438496Z","iopub.execute_input":"2023-02-04T16:27:27.439369Z","iopub.status.idle":"2023-02-04T16:27:27.491063Z","shell.execute_reply.started":"2023-02-04T16:27:27.439316Z","shell.execute_reply":"2023-02-04T16:27:27.489700Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"feature_subset = ['product_group_name', 'product_type_name',\n       'graphical_appearance_name', 'colour_group_name',\n       'perceived_colour_value_name',\n       'perceived_colour_master_name',\n       'department_name', 'index_name',\n       'index_group_name', 'section_name',\n       'garment_group_name']","metadata":{"papermill":{"duration":0.014626,"end_time":"2022-05-19T04:43:03.358087","exception":false,"start_time":"2022-05-19T04:43:03.343461","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-02-04T16:27:27.492497Z","iopub.execute_input":"2023-02-04T16:27:27.492870Z","iopub.status.idle":"2023-02-04T16:27:27.502179Z","shell.execute_reply.started":"2023-02-04T16:27:27.492837Z","shell.execute_reply":"2023-02-04T16:27:27.500551Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dum = pd.get_dummies(df, columns=feature_subset)","metadata":{"papermill":{"duration":0.549826,"end_time":"2022-05-19T04:43:03.915541","exception":false,"start_time":"2022-05-19T04:43:03.365715","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-02-04T16:27:27.505231Z","iopub.execute_input":"2023-02-04T16:27:27.505694Z","iopub.status.idle":"2023-02-04T16:27:28.086717Z","shell.execute_reply.started":"2023-02-04T16:27:27.505654Z","shell.execute_reply":"2023-02-04T16:27:28.085272Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pickle \nwith open('article_embeddings_from_features.pickle', 'wb') as f:\n    pickle.dump(dum, f)","metadata":{"papermill":{"duration":0.130389,"end_time":"2022-05-19T04:43:04.054344","exception":false,"start_time":"2022-05-19T04:43:03.923955","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2023-02-04T16:27:28.088284Z","iopub.execute_input":"2023-02-04T16:27:28.088673Z","iopub.status.idle":"2023-02-04T16:27:28.241284Z","shell.execute_reply.started":"2023-02-04T16:27:28.088638Z","shell.execute_reply":"2023-02-04T16:27:28.240031Z"},"trusted":true},"execution_count":null,"outputs":[]}]}