# 11th place solution

Thanks Kaggle and H&M for hosting this exciting competition, my teammate
[@niwatori](https://www.kaggle.com/niwatori)
and all participants competing with us.
Here is a brief summary of our solution.
1. Candidate generation
As discussed in the forum, we used multiple recall methods to generate the candidates.
repurchase
items with the same product code in repurchase
popular items
category-wise popular items
list the popular items for each department_no
add them if the customer has bought the item with the same department_no
item2item collaborative filtering
similarity based on tag ohe vector
create item ohe vector from the tags (product_type_no, product_group_name, etc…)
create user vector which is the average of the item vector bought by the customer
select top-k items based on the similarity between the user vector and item vector
We left most of the columns added during the candidate generation stage so that we can utilize them as features.
2. Feature engineering
In addition to the columns generated during the above phase, We added features as follows:
user static features
item static features
dynamic features (same for both user and item)
mean and std of price, sales_channel_id
date-diff since the last transaction
volume/rank of volume in the last few weeks
user-item features
date-diff since the day (user, item) pair last occurred
count of (user, item), (user’s age, item) pair occurred in the last few weeks
dot product of item ohe vector and user vector
user embedding from light-fm
3. Training
We used CatBoost ranker (YetiRank). We also tried to use LGBMRanker, but CatBoost gave much better results in our case. We found that the default parameter gave decent results compared tuned one.
We used 6, 8, and 12 weeks for training and left the last week for validation. It took up to 20h with a 224 core machine for training a single model.
Our best single was cv: 0.03589, public: 0.03381,  private: 0.03391.
Throughout the competition, our validation/public basically correlated positively, but we observed that changing the training weeks gave a negative correlation. (worse cv score, better public/private score)
4. Ensembling
We followed the ensembling method introduced by
[https://www.kaggle.com/code/chaudhariharsh/lb-0-0238-h-m-ensembling-how-to-get-bronze](https://www.kaggle.com/code/chaudhariharsh/lb-0-0238-h-m-ensembling-how-to-get-bronze)
We ensembled 4 models trained with different training weeks and different parameters.
Notes
update
Here is our source code:
[https://github.com/ryowk/kaggle-h-and-m-personalized-fashion-recommendations](https://github.com/ryowk/kaggle-h-and-m-personalized-fashion-recommendations)