# Part of 22nd solution - single LGBM (Private:0.03038)

I'd like to thank this great competition's hosts and congrats winners and all medalists!
Super thanks
[@myaun](https://www.kaggle.com/myaun)
[@NARI](https://www.kaggle.com/NARI)
[@Moro](https://www.kaggle.com/Moro)
[@minguin](https://www.kaggle.com/minguin)
for giving great ideas and solution as a team.
In this post, I would show you my part of solution.
I think my solution is quite simple but takes time to train and infer.
My solution is published as Kaggle notebook.
If you like it ,please post comments and upvote.
[22nd-place-lgbm-model-single-train](https://www.kaggle.com/code/iwatatakuya/22nd-place-lgbm-model-single-train)
[22nd-place-lgbm-model-single-infer](https://www.kaggle.com/code/iwatatakuya/22nd-place-lgbm-model-single-infer)
environment and validation strategy
I used mainly Google Colab Pro+ because I need GPU (cudf, cuml) for fast training and inference with heavy data processing.
It takes about 15 hours to train and 7 hours to infer (for validation data) and 100 hours to infer (for test data) with 1 GPU.
Google Colab Pro+'s multi-session made it 2 times faster but still it takes too much time.
I used 2020/9/16~9/22 data for validation and used ~2020/9/15 for training.
Dataset for training
Maybe this part is most characteristic in my solution.
First, I made dataset of customers who bought some items in 2020/9/9~9/15, 9/2~9/8, 8/25~9/1 and 8/18~8/24.
The primary key are customer_id and article_id and each pair has target column with 1 (bought) or 0 (did not buy).
We cannot use all articles which customer did not buy because they are too much quantity, so I randomly selected 30 articles as negative sample for each customer.
I think features I made are not so special such as n_buy for customer and article.
Please see my notebook for detail.
Training
I used LGBM Classifier (not Ranker).
In my case, Classifier was better than Ranker.
Inference
I scored each pair of customer and item and sorted to predict items which the customer seems to buy.
Candidate items are top sales 15,000 items in 2020/8/18~2020/9/15.
Candidate items are same among customers.
Such large number of candidates makes inference slower but it effects score significantly.
Thank you for reading this far.
Questions are welcome!