{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceId":31254,"databundleVersionId":3103714,"sourceType":"competition"}],"dockerImageVersionId":31192,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\n\nbase_dir = \"/kaggle/input\"\n\nfor name in os.listdir(base_dir):\n    path = os.path.join(base_dir, name)\n    if os.path.isdir(path):\n        files = os.listdir(path)\n        print(path, \"-> example files:\", files[:5])  # in thử 5 file đầu\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2025-12-15T03:15:22.73769Z","iopub.execute_input":"2025-12-15T03:15:22.738412Z","iopub.status.idle":"2025-12-15T03:15:23.000435Z","shell.execute_reply.started":"2025-12-15T03:15:22.738377Z","shell.execute_reply":"2025-12-15T03:15:22.999671Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"DATA_DIR = \"/kaggle/input/h-and-m-personalized-fashion-recommendations\"\n\narticles = pd.read_csv(f\"{DATA_DIR}/articles.csv\")\ncustomers = pd.read_csv(f\"{DATA_DIR}/customers.csv\")\ntransactions = pd.read_csv(f\"{DATA_DIR}/transactions_train.csv\")\n\nprint(articles.shape)\nprint(customers.shape)\nprint(transactions.shape)\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-15T03:15:23.001638Z","iopub.execute_input":"2025-12-15T03:15:23.002043Z","iopub.status.idle":"2025-12-15T03:16:28.51579Z","shell.execute_reply.started":"2025-12-15T03:15:23.00201Z","shell.execute_reply":"2025-12-15T03:16:28.514721Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"rm -rf m-fashion-recsys-catboost && git clone https://github.com/sylinh/m-fashion-recsys-catboost.git","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-15T03:16:28.516727Z","iopub.execute_input":"2025-12-15T03:16:28.516968Z","iopub.status.idle":"2025-12-15T03:16:29.731252Z","shell.execute_reply.started":"2025-12-15T03:16:28.516949Z","shell.execute_reply":"2025-12-15T03:16:29.73056Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!ls /kaggle/working\n!ls /kaggle/working/m-fashion-recsys-catboost","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-15T03:16:29.733229Z","iopub.execute_input":"2025-12-15T03:16:29.733447Z","iopub.status.idle":"2025-12-15T03:16:30.047525Z","shell.execute_reply.started":"2025-12-15T03:16:29.733425Z","shell.execute_reply":"2025-12-15T03:16:30.046778Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"%cd /kaggle/working/m-fashion-recsys-catboost\n\n# xem trong thư mục kaggle có gì\n!ls kaggle","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-15T03:16:30.048576Z","iopub.execute_input":"2025-12-15T03:16:30.04886Z","iopub.status.idle":"2025-12-15T03:16:30.208474Z","shell.execute_reply.started":"2025-12-15T03:16:30.048832Z","shell.execute_reply":"2025-12-15T03:16:30.207807Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"%cd /kaggle/working/m-fashion-recsys-catboost\n\nINPUT_DIR = \"/kaggle/input/h-and-m-personalized-fashion-recommendations\"\nWORK_DIR  = \"/kaggle/working/hm_catboost_work\"\nOUT_SUB   = \"/kaggle/working/submission.csv\"\n\n!mkdir -p $WORK_DIR\n!mkdir -p $WORK_DIR/data/processed\n\n!PYTHONPATH=/kaggle/working/m-fashion-recsys-catboost \\\n  python kaggle/full_pipeline.py \\\n    --input-dir \"$INPUT_DIR\" \\\n    --work-dir \"$WORK_DIR\" \\\n    --out-submission \"$OUT_SUB\" \\\n    --train-weeks 1 \\\n    --valid-week 1 \\\n    --recall-topk-method 50 \\\n    --recall-topk-merge 200\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-15T04:11:37.848554Z","iopub.execute_input":"2025-12-15T04:11:37.849546Z","iopub.status.idle":"2025-12-15T04:14:26.757066Z","shell.execute_reply.started":"2025-12-15T04:11:37.84951Z","shell.execute_reply":"2025-12-15T04:14:26.75259Z"}},"outputs":[],"execution_count":null}]}