Git Product home page Git Product logo

abhijitpai000 / customer_lifetime_value Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 707 KB

Trained a Probabilistic Model to forecast the frequency of purchases and how likely a customer is to churn in a given time period using their historical transaction data.

License: MIT License

Python 100.00%
customer-lifetime-value customer-relationship-management customer-analytics predictive-analytics buy-til-you-die e-commerce data-science python

customer_lifetime_value's Introduction

Customer Lifetime Value.

Forecasting Number of transactions a customer would make using Beta Geometric-Negative Binomial Distribution, a BTYD-Probabilistic Model.

Overview

Trained a Beta Geometric-Negative Binomial Distribution (BG/NBD) model that explains how frequently customers make purchases while they are still "alive" and how likely a customer is to churn in any given time period, using customer transactions of E-Commerce store Olist public dataset

Model Outcome

Trained Model Predicts Number of Purchases with an RMSE of 0.144 and is able to capture 99% of customer historical transactions with a frequency less than or equal to 4, and only less than 1% of customers have greater than 4 repeated purchases in the dataset.

image.png

Model vs Actual - Cumulative Transactions and Daily Transactions image-3.png

About Olist Dataset

The dataset has information of 100k orders from 2016 to 2018 made at multiple marketplaces in Brazil, the orders are divided into 9 .csv files in a relational database schema.

For this study, I have aggregrated data using the following 3 .csv files out of the 9 in the zip file.

  • olist_customers_dataset.csv
  • olist_orders_dataset.csv
  • olist_payments_dataset.csv

Source : Olist Dataset

Final Report & Package Walk-Through

To reproduce this study, use modules in 'src' directory of this repo. (setup instructions below) and walk-through of the package is presented in the final report

Setup instructions

Creating Python environment

This repository has been tested on Python 3.7.6.

  1. Cloning the repository:

git clone https://github.com/abhijitpai000/customer_lifetime_value.git

  1. Navigate to the git clone repository.

cd customer_lifetime_value

  1. Download raw data from the data source link and place in "datasets" directory

  2. Install virtualenv

pip install virtualenv

virtualenv clv

  1. Activate it by running:

clv/Scripts/activate

  1. Install project requirements by using:

pip install -r requirements.txt

Note

  • For make_dataset(), please place the unzipped raw data (from data source) in the 'datasets' directory.

customer_lifetime_value's People

Contributors

abhijitpai000 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

uspa-technology

customer_lifetime_value's Issues

rest api with flask

Hi @abhijitpai000 ,

Hope you are all well !

I was wondering if we could not create a flask rest api for your repository, it woud be awesome to compute data from e-commerce cms like Prestashop or Magento2.

What do you think about it ? How complicated it would be ?

Thanks for any insights or inputs on that.

Cheers,
Luc Michalski

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.