4
$\begingroup$

Lets say I have 10 sellers (S1-S10). Each seller has 7 buyers which are different for each seller (B1-B7 for S1, B11-B17 for S2 and so on). Each Seller buyer combination has a product category (P1, P2...) which can be repetitive for both inter and intra sellers. Now X variables are divided into 3 categories - Seller attributers, buyer attributes and interaction variables. Y is a binary variable saying transaction happened or not.

Seller, Buyer, Prd Cat, ... X variables, transaction
S1, B1, P1 ..........................., 1 
S1, B2, P2 ..........................., 0  
S1, B3, P3 ..........................., 1  
S1, B4, P1 ..........................., 1  
S1, B5, P2 ..........................., 0  
S1, B6, P4 ..........................., 0  
S1, B7, P4 ..........................., 1  
S2, B11, P5 .........................., 0 
S2, B12, P2 ..........................., 0  
S2, B13, P1 ..........................., 1 
S2, B14, P6 ..........................., 1  
S2, B15, P7 ..........................., 0  
S2, B16, P3 ..........................., 0
S2, B17, P3 ..........................., 1

and so on...

I have to find the probability of transaction for every seller buyer combo. I have tried mixed effect random forest and XGBoost with introducing dummy for each seller. Also to reduce the variance, I tried clustering to group similar sellers and seller product combos and then made dummy for those. My accuracy for the model did increase after trying multiple methods. Most of the models in mixed effect have a continuous variable.

Is there a way to model this kind of data through GLMM in python?
Or Is there a better way to attack such structure of data in general?

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.