Git Product home page Git Product logo

customer-clustering-using-kmeans-sqlconnector's Introduction

Customer Clustering with KMeans & SQLconnector

Project status: Finished.

Project objective

The main goal here is to use KMeans clustering to define the customer importance, based on two main variables: the total monetary spent (BRL), and frequency of purchase by customer.

This is and End-to-End Machine Learning Project for Customer Clusterization, from Database creation to Development of ML algorithm and bussiness analysis of results.

Take a look into the data Schema used to build our DataFrame:

: Source: Kaggle

Technologies

List of technologies:


Daniel-sql Daniel-psgre
  • Machine Learning: scikit-learn

Steps

To summarize, the model was developed with the following steps:

  1. Database creation (DDL) on mySQL ID; 1.1. data convertion from CSV to SQL format; 1.2. building Relationships between tables;
  2. my SQL integration with python (mysql-connector) 2.1. writting of CRUD queries inside jupyter notebook and convertion to pandas DataFrame;
  3. Development of ML algorithm and bussiness analysis of results;

Methods

To classify customers, based on income generated and frequency of purchases, it was used an Unsupervised Machine Learning method: KMeans Clustering.

K-means clustering is a method of vector quantization, that aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean (cluster centers or cluster centroid), serving as a prototype of the cluster.

K-means clustering minimizes within-cluster variances (squared Euclidean distances), but not regular Euclidean distances, which would be the more difficult Weber problem: the mean optimizes squared errors, whereas only the geometric median minimizes Euclidean distances.

Conclusion

It is clear that beyond k = 5, the Sum Squared Distance starts to take a more plain decrease. Therefore, the optimal number of client clusters is 5. In other words, that means this company has 5 levels of customers to consider different marketing approaches. Lastly, the python connector was used to write a query to update the database.

Contact

customer-clustering-using-kmeans-sqlconnector's People

Contributors

melo97 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.