Lottery Purchase Prediction Model
Objective and Goal
Predict the lottery type that the user in the session will buy, using the discrete features from the user face image and user’s historical purchase data.
Recommend lottery types to users and improve the order conversion rate, in order to increase sales revenue.
The feature from the user face image in the Session (from Baidu Face Recognition API)：
Beauty, Expression, Emotion, Face ID (optional, only for old users)
Other features from Session：
Session Time (in 24 hours)
Use the session face id to get user id, and retrieve the historical order data of this user：
City, Lottery Type, New/Old Users, Lottery Station Type (supermarket, restaurant), Total Purchase Days, Frequently Purchase Lottery Type
If this is a new user and there is no user id, the feature from historical order data will be replaced by mean or mode.
Data Cleaning and Selected Features
Transform the continuous variables to one-hot encoding variables, and check whether they are strongly correlated with the dependent variable. There are 18 features in total after variable selection:
|Neutral Emotion||session face|
|Positive Emotion||session face|
|Ten Times Good Luck||historical order|
|Other Lottery Type||historical order|
|Total Purchase Days||historical order|
|New User||historical order|
|Chess Room||historical order|
Concatenate all the feaures, and input to a 3-layers MLP in PyTorch. Then perform a multiclass classification task and predict the lottery type the user will buy in the session (Two-color Ball, Ten Times Good Luck, Welfare Lottery 3D, Other Lottery Type).
Prediction result using historical data
Accuracy metrics using the data from 07/2021:
|Ten Times Good Luck||0.814|
|Welfare Lottery 3D||0.822|
|Other Lottery Type||0.908|
Model Call Method
python3 app.py \ --port=8827 \ --debug=False \ --host='127.0.0.1' \ --appname='buy_prediction' \ --threaded=True