Git Product home page Git Product logo

lifetime_value's Introduction

Lifetime Value

Accurate predictions of customers’ lifetime value (LTV) given their attributes and past purchase behavior enables a more customer-centric marketing strategy. One challenge of LTV modeling is that some customers never come back, and the distribution of LTV can be heavy-tailed. The commonly used mean squared error (MSE) loss does not accommodate the significant fraction of zero value LTV from one-time purchasers and can be sensitive to extreme large LTV from top spenders.

We model the distribution of LTV given associated features as a mixture of zero point mass and lognormal distribution, which we refer to as zero-inflated lognormal (ZILN) distribution. This modeling approach enables us to capture the churn probability and account for heavy-tailedness nature of LTV at the same time, and also allows for easy uncertainty quantification of the point prediction. The proposed loss function can be used in both linear models and deep neural networks (DNN). We also advocate normalized Gini coefficients to quantify model discrimination and promote decile charts to assess model calibration.

The proposed loss function (implemented in Keras) and evaluation metrics are integrated into a python package. And we demonstrate the predictive performance of our proposed model in notebooks on two real-world public datasets.

Paper

Wang, Xiaojing, Liu, Tianqi, and Miao, Jingang. (2019). A Deep Probabilistic Model for Customer Lifetime Value Prediction. arXiv:1912.07753.

Installation

The easiest way is propably using pip:

pip install -q git+https://github.com/google/lifetime_value

If you are using a machine without admin rights, you can do:

pip install -q git+https://github.com/google/lifetime_value --user

If you are using Google Colab, just add "!" to the beginning:

!pip install -q git+https://github.com/google/lifetime_value

Package works for python 3 only.

Usage

Package can be imported as

import lifetime_value as ltv

notebooks

The best way to learn how to use the package is probably by following one of the notebooks, and the recommended way of opening them is Google Colab.

Kaggle Acquire Valued Shoppers Challenge Dataset

This Kaggle challenge provides almost 350 million rows of completely anonymised transactional data from over 300,000 shoppers. We use the transactional data to demonstrate LTV modeling.

We download the transaction.csv (21GB) file from Kaggle server and prepare csv files for each of top 20 most common companies. Then we train a Keras model to predict customer's lifetime value and returning probability.

The raw data is available here.

  • Data preparation downloads kaggle data transaction.csv and preprocesses the top 20 most common companies' data to customer-level one. This is optional, and running this will save time for regression and classification because the data are cached.
  • Regression trains a Keras regression linear/dnn model with specified loss function and evaluates the results.
  • Classification trains a Keras classification linear/dnn model with specified loss function and evaluates the results.

KDD Cup 98

The Second International Knowledge Discovery and Data Mining Tools Competition (a.k.a., the KDD Cup 1998) provides a dataset collected by Paralyzed Veterans of America (PVA), a non-profit organization that provides programs and services for US veterans with spinal cord injuries or disease. The organization raised money via direct mailing campaigns and was interested in lapsed donors: people who have stopped donating for at least 12 months. The provided dataset contains around 200K such donors who received the 1997 mailing and did not make a donation in the previous 12 months. We tackle the same task of the competition, which is to predict the donation dollar value to the 1997 mailing campaign.

The raw data is available here.

  • Regression trains regression models and makes comparisons on different methods.

People

Package is created and maintained by Xiaojing Wang, Tianqi Liu, and Jingang Miao.

lifetime_value's People

Contributors

miaojingang avatar terenceliu4444 avatar wangxj03 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.