Package: scikit-uplift
scikit-upliftscikit-uplift (sklift)is an uplift modeling python package that provides fast sklearn-style models implementation, evaluation metrics and visualization tools.Uplift modeling estimates a causal effect of treatment and uses it to effectively target customers that are most likely to respond to a marketing campaign.Use cases for uplift modeling:Target customers in the marketing campaign. Quite useful in promotion of some popular product where there is a big part of customers who make a target action by themself without any influence. By modeling uplift you can find customers who are likely to make the target action (for instance, install an app) only when treated (for instance, received a push).Combine a churn model and an uplift model to offer some bonus to a group of customers who are likely to churn.Select a tiny group of customers in the campaign where a price per customer is high.Read more about uplift modeling problem inUser Guide.Articles in russian on habr.com:Part 1,Part 2andPart 3.Why skliftСomfortable and intuitivescikit-learn-like API;More uplift metrics than you have ever seen in one place! Include brilliants likeArea Under Uplift Curve(AUUC) orArea Under Qini Curve(Qini coefficient) with ideal cases;Supporting any estimator compatible with scikit-learn (e.g. Xgboost, LightGBM, Catboost, etc.);All approaches can be used in thesklearn.pipeline. See the example of usage onthe Tutorials page;Also metrics are compatible with the classes fromsklearn.model_selection. See the example of usage onthe Tutorials page;Almost all implemented approaches solve classification and regression problems;Nice and useful viz for analysing a performance model.InstallationInstallthe package by the following command from PyPI:pipinstallscikit-upliftOr install from source:gitclonehttps://github.com/maks-sh/scikit-uplift.gitcdscikit-upliftpythonsetup.pyinstallDocumentationThe full documentation is available atuplift-modeling.com.Or you can build the documentation locally usingSphinx1.4 or later:cddocspipinstall-rrequirements.txtmakehtmlAnd if you now point your browser to_build/html/index.html, you should see a documentation site.Quick StartSee theRetailHero tutorial notebook(EN,RU) for details.Train and predict uplift modelUse the intuitive python API to train uplift models withsklift.models.# import approachesfromsklift.modelsimportSoloModel,ClassTransformation# import any estimator adheres to scikit-learn conventions.fromlightgbmimportLGBMClassifier# define modelsestimator=LGBMClassifier(n_estimators=10)# define metamodelslearner=SoloModel(estimator=estimator)# fit modelslearner.fit(X=X_tr,y=y_tr,treatment=trmnt_tr,)# predict upliftuplift_slearner=slearner.predict(X_val)Evaluate your uplift modelUplift model evaluation metrics are available insklift.metrics.# import metrics to evaluate your modelfromsklift.metricsimport(uplift_at_k,uplift_auc_score,qini_auc_score,weighted_average_uplift)# Uplift@30%uplift_at_k=uplift_at_k(y_true=y_val,uplift=uplift_slearner,treatment=trmnt_val,strategy='overall',k=0.3)# Area Under Qini Curveqini_coef=qini_auc_score(y_true=y_val,uplift=uplift_slearner,treatment=trmnt_val)# Area Under Uplift Curveuplift_auc=uplift_auc_score(y_true=y_val,uplift=uplift_slearner,treatment=trmnt_val)# Weighted average upliftwau=weighted_average_uplift(y_true=y_val,uplift=uplift_slearner,treatment=trmnt_val)Vizualize the resultsVisualize performance metrics withsklift.viz.fromsklift.vizimportplot_qini_curveimportmatplotlib.pyplotaspltfig,ax=plt.subplots(1,1)ax.set_title('Qini curves')plot_qini_curve(y_test,uplift_slearner,trmnt_test,perfect=True,name='Slearner',ax=ax);plot_qini_curve(y_test,uplift_revert,trmnt_test,perfect=False,name='Revert label',ax=ax);DevelopmentWe welcome new contributors of all experience levels.Please see ourContributing Guidefor more details.By participating in this project, you agree to abide by itsCode of Conduct.Thanks to all our contributors!If you have any questions, please contact us atteam@uplift-modeling.comImportant linksOfficial source code repo:https://github.com/maks-sh/scikit-uplift/Issue tracker:https://github.com/maks-sh/scikit-uplift/issuesDocumentation:https://www.uplift-modeling.com/en/latest/User Guide:https://www.uplift-modeling.com/en/latest/user_guide/index.htmlContributing guide:https://www.uplift-modeling.com/en/latest/contributing.htmlRelease History:https://www.uplift-modeling.com/en/latest/changelog.htmlPapers and materialsGutierrez, P., & Gérardy, J. Y.Causal Inference and Uplift Modelling: A Review of the Literature.
In International Conference on Predictive Applications and APIs (pp. 1-13).Artem Betlei, Criteo Research; Eustache Diemert, Criteo Research; Massih-Reza Amini, Univ. Grenoble AlpesDependent and Shared Data Representations improve Uplift Prediction in Imbalanced Treatment Conditions
FAIM’18 Workshop on CausalML.Eustache Diemert, Artem Betlei, Christophe Renaudin, and Massih-Reza Amini. 2018.A Large Scale Benchmark for Uplift Modeling.
In Proceedings of AdKDD & TargetAd (ADKDD’18). ACM, New York, NY, USA, 6 pages.Athey, Susan, and Imbens, Guido. 2015.Machine learning methods for estimating heterogeneous causal effects.
Preprint, arXiv:1504.01132. Google Scholar.Oscar Mesalles Naranjo. 2012.Testing a New Metric for Uplift Models.
Dissertation Presented for the Degree of MSc in Statistics and Operational Research.Kane, K., V. S. Y. Lo, and J. Zheng. 2014.Mining for the Truly Responsive Customers and Prospects Using True-Lift Modeling:
Comparison of New and Existing Methods.
Journal of Marketing Analytics 2 (4): 218–238.Maciej Jaskowski and Szymon Jaroszewicz.Uplift modeling for clinical trial data.
ICML Workshop on Clinical Data Analysis, 2012.Lo, Victor. 2002.The True Lift Model - A Novel Data Mining Approach to Response Modeling in Database Marketing.
SIGKDD Explorations. 4. 78-86.Zhao, Yan & Fang, Xiao & Simchi-Levi, David. 2017.Uplift Modeling with Multiple Treatments and General Response Types. 10.1137/1.9781611974973.66.Nicholas J Radcliffe. 2007.Using control groups to target on predicted lift: Building and assessing uplift model. Direct Marketing Analytics Journal, (3):14–21, 2007.Devriendt, F., Guns, T., & Verbeke, W. 2020.Learning to rank for uplift modeling. ArXiv, abs/2002.05897.TagsEN: uplift modeling, uplift modelling, causal inference, causal effect, causality, individual treatment effect, true lift, net lift, incremental modelingRU: аплифт моделирование, Uplift модельZH: uplift增量建模, 因果推断, 因果效应, 因果关系, 个体干预因果效应, 真实增量, 净增量, 增量建模