1
$\begingroup$

I'm trying to predict when a customer would buy a product(which month of the year) based on the historical transactions. I have 3 years transactions data and good amount of customers are frequent ones. Or basically want to mine the historical transaction data, and see for a set of customers (in a Geo/type of customer etc.) which months are likely period of buying a product X.

Can someone please advice which Machine learning technique or statistical approach would be best in this case.

I am trying - Decision tree classification/Logistic regression model taking month as predictor variable. - Statistical analysis to see which month is more significant for a set of customers.

$\endgroup$

1 Answer 1

1
$\begingroup$

I would try using xgboost classifier. In my case, xgboost outperformed Random Forest.

import xgboost as xgb
xgb_model = xgb.XGBClassifier(
    learning_rate=0.1, n_estimators=1000, max_depth=3, min_child_weight=1,
    gamma=0, subsample=0.8, colsample_bytree=0.8, objective='binary:logistic',
    nthread=4, scale_pos_weight=1, seed=27)

You can use the below snippet to avoid over fitting problem.

xgb_model = xgb_model.fit(X_train, y_train.astype(int), early_stopping_rounds=50,
                          eval_set=[(X_test, y_test['target'])])
$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.