Giter Club home page Giter Club logo

anvss1 / pfe Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 914 KB

This project dives deep into customer sales data to uncover valuable insights for business decision-making. It leverages machine learning and time-series forecasting to predict customer churn, forecast product demand, and segment customers based on their purchasing behavior.

License: Apache License 2.0

Jupyter Notebook 99.77% Python 0.23%
clustering clv clv-analysis data-science forecasting-models kmeans kmeans-clustering machine-learning prophet prophet-facebook python shap xgboost

pfe's Introduction

Sales Analytics and Prediction Project

This project dives deep into customer sales data to uncover valuable insights for business decision-making. It leverages machine learning and time-series forecasting to predict customer churn,customer lifetime value (CLV) prediction, forecast product demand, and segment customers based on their purchasing behavior.

Table of Contents

Project Overview

This repository contains Jupyter Notebooks and Python scripts for comprehensive sales analysis, addressing these key business challenges:

  1. Customer Churn Prediction: Identifies customers at risk of leaving, enabling proactive retention strategies.
  2. Demand Forecasting: Forecasts future product demand to optimize inventory levels and sales planning.
  3. Customer Segmentation: Groups customers based on purchase behavior, enabling targeted marketing and personalization.
  4. Customer Lifetime Value (CLV) Prediction: Estimates the long-term value of each customer to guide resource allocation and customer relationship management.

Data

Models and Analyses

Churn Prediction

  • Model: XGBoost Classifier (optimized via GridSearchCV)
  • Features:
    • Aggregated metrics: total orders, average order value, recency, frequency, unique products purchased
    • Calculated features: time since first/last purchase, change in purchase frequency, etc.
  • Evaluation:
    • Metrics: Accuracy, precision, recall, F1-score, ROC-AUC, Precision-Recall Curve.
    • Interpretation: SHAP (SHapley Additive exPlanations) for understanding feature importance.

Demand Forecasting

  • Model: Facebook Prophet
  • Data: Aggregated daily (or other frequency) sales data.
  • Optional: External regressors (holidays, promotions, etc.).

Customer Segmentation

  • Model: K-Means Clustering
  • Features: Standardized subset of relevant customer features.
  • Evaluation: Elbow method, Silhouette analysis, interpretability of clusters.

Customer Lifetime Value (CLV)

  • Model: BG/NBD (Beta Geometric/Negative Binomial Distribution) model from the lifetimes library
  • Features: Recency, frequency, monetary value of transactions
  • Output: Predicted CLV for each customer over a 12-month period.

Power BI Dashboard

This interactive dashboard provides a user-friendly way to explore and visualize the key insights from your sales data analysis. It's organized into three main sections, offering a holistic view of customer behavior, product performance, and overall sales trends.

Sales Report

  1. Revenue Analysis:

    • Map: Geographic distribution of sales figures by city.
    • Animation: Evolution of customer segments based on total spending.
    • Line Chart: Total sales trend over time, broken down by month and year.
    • Table: Detailed sales data for each city, with summaries by family, range, and order counts.
  2. Product Insights:

    • Cards: Top-selling products, sub-families, and ranges.
    • Table: Granular order data, including product counts and order values.
    • Pie Chart: Distribution of orders by day of the week.

Clients Analysis

  1. Customer Overview:

    • Card: Number of customers
    • Card: City with the most customers
    • Histogram: Customer count by city
    • Interactive Map: Exploration of customer locations.
    • Timeline/Table: First and last order dates for each customer.
  2. Churn Insights:

    • Pie Chart: Proportion of churned vs. not churned customers.
    • Table: Detailed customer data, including churn predictions.

Products Analysis

  1. Product Overview:
    • Cards: Number of products and unique ranges.
    • Interactive Map: Sales by city and product.
    • Table: Product details with associated range, order counts, and total quantity sold.

Usage

  1. Install Packages: pip install pandas numpy scikit-learn xgboost prophet lifetimes plotly ipywidgets
  2. Jupyter Notebooks:
    • data_preparation.ipynb: Load and preprocess your data.
    • churn_prediction.ipynb: Train and evaluate the churn prediction model.
    • demand_forecasting.ipynb: Generate demand forecasts.
    • customer_segmentation.ipynb: Perform customer segmentation.
    • clv_prediction.ipynb: Calculate Customer Lifetime Value.
  3. Examine Results: Look at visualizations, evaluation metrics, and SHAP explanations.
  4. Apply Insights: Translate findings into actionable recommendations for your business.

Limitations and Future Work

  • Explore Additional Models: Experiment with alternative algorithms for churn prediction and demand forecasting.
  • Incorporate External Data: Enhance demand forecasts by including data on promotions, holidays, and other relevant factors.
  • Expand Dashboard: Add more visualizations and interactivity to the Power BI dashboard.

pfe's People

Contributors

anvss1 avatar

Stargazers

 avatar

Watchers

 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.