# #11 Solution

Congratulations to winners. This is a really interesting competition and I have learned a lot from it. Here is a brief overview of my solution.
Models:
User-Product pairs
:
The probability of user-product pair is predicted by LightGBM model. The model is trained with all training data + part of priors data. Limited to my ram, I add the last 2 prior orders of every user, which boosts my score about 0.001. Adding the last 3 or 4 prior orders may help to get a better score.
Pnone
:
Pnone is calculated in two ways：1) (1-P1)(1-P2)…(1-Pn) from user-product model. PNone is underestimated in this way since it doesn’t consider the correlation. I multiply a coefficient to calibrate PNone and have a slight improvement on the score. 2) I build a separate model to predict PNone, and features of this model are from order-level features in main models. Average PNone of these two ways show a better performance compared with single none predict model.
Features:
I have generated about 300 features and 120 features are used in final models. Here are some of the important features in my model that I have not found in public kernel or sh1ng’s script.
User_product_diversity
: 
This feature is to capture user diversity of each aisle or depart. It is calculated as the number of distinct products in this aisle/depart for the user. It can be calculated in the last 3 orders or all prior orders.
User_dumb_degree
: 
If we predict the Nth order that the user will repeat all products in the N-1 th order, then we can calculate precise, recall and f1 score of the Nth order in this dumb strategy. This is a new order-level feature to capture user dump degree, and we can calculate the mean, std, last of dump degree of each user. This idea is inspired by @Jonathan Weisberg.
User_product_history
: 
This feature tries to record user product in the last five orders. If a user has 8 orders, user_product_history such as ‘00101’ represents that he buys the product in the 5, 7th order and does not buy the product in the 3,4,6th order. This feature is like order streak and contains more information.
User_time_order_ratio
: 
The proportion of user orders in this dow (hours, days_since) to user_total_orders. Hours and days_since_prior_orders are divided into four groups since every user only has a small number of orders. These features try to capture whether this order is out of ordinary.
Ensemble:
Final submission is an ensemble of 4 LightGBM models with different features, datasets, params. The weights are decided by LB score and cv.
Thanks all.