This notebook helps to track the movement of customers across various Advanced customer segments across different time periods.

Advanced Customer Segmentation

The advanced customer segmentation aims to create different behavior-based clusters of our customer base. This is a lot different from the basic “RFM Segmentation” as there will be more features involved in this type of segmentation and it will not be limited to just “Recency”, “Frequency” and “Monetary” features. The more features/context we input in this type of segmentation, the better will be the outcome. 

The first step that needs to be performed before running the advanced segmentation notebook is to create a Customer Single View. That will have all the features that users would like to use as inputs for the segmentation. 

All the features/KPIs must be present at a customer level.

Customer Single View Checkpoints

  1. Keep only one unique identifier for each customer in this table.
  2. All the features must be numeric data types.
  3. If there are any categorical variables, then these must be hot encoded and converted to numerical data types.
  4. One mandatory feature that should be present in the single view is “No. of Visits”/”Frequency. As the segmentation will only be done for customers who have made more than one visit with a brand. This is done because one visit only will not be enough to determine a customer’s behavior.

Input Parameters

You need to provide the following details before running the Notebook.

Input Param
Description
Single View DBEnter the name of the database which has the customer single view table.
Single View Table NameEnter the name of the table of customer single view.
Frequency ColumnEnter the name of the column that has information related to no. of visits made by the customers.
User IdentifierEnter the name of the column which has the unique identifier for each customer.
Database NameEnter the name of the database where we want to store the table.
Table nameEnter the table name where we want to store our data.

Notebook Flow

  1. Null Values Removal: We are dealing the following with null values.
    1. If a certain feature has more than 95% of its values as null, then we are dropping that feature from the analysis.
    2. If a certain feature has less than or 20% of its values as null, then we are replacing the null value with the median value.
    3. For the rest of the cases, we are replacing them with 0.
  2. Scaling the Feature Matrix: In order to bring all the variables to a common scale, we have to transform the feature matrix and bring it to a common scale.
  3. Feature Reduction: As the single view will be having a lot of features and some of them will surely be highly correlated to one another. To avoid that we have used a famous dimensionality reduction technique known by the name “PCA”.
  4. Selecting the right no. of PCs: The principal components tend to reduce our dimensions by explaining as much variation as possible. Right now, we have kept the cut-off of explained variance to be 80% i.e we will be considering only the number of principal components till which the cumulative explained variance is <=80%.
  5. Creating Segments: We have used the K Means clustering method for creating the final set of segments after reducing dimensionality.
  6. Final Output: The final output of the notebook can be obtained from command 35. After interpreting the output, the user can run the notebook again and input the no. of segments to be created in command 37.
  7. Naming the Segments: After finalizing the number of clusters, name each cluster number as per your accordance. The notebook already has a sample code for 5 clusters. You can add or remove the clusters as per your output.

    For example: For 6 clusters, we will have 0,1,2,3,4,5 as our cluster number. You have to add another entry in the following command.

    • Similarly, you can remove as well. 
    • Make sure you have the same users for both time periods to get the movement.
    • Do the above process for both the time periods separately and then run the below notebook to get the movement of users across advanced segments.
      Link to Movement Across Advanced Segments Notebook.

Notebook Links

Open your cluster-specific link provided for the Notebook.

Notebook
Cluster links
Movement of Users Across Advance Segments    
India, SEA, EMEA