# ChurnKB: A Generative AI-Enriched Knowledge Base for Customer Churn Feature Engineering
## 3 Method
### Developing a Knowledge Base-Enhanced Classifier for Identifying Customer Churn-Related Patterns  
This work enhances ML classification using ChurnKB-driven features. By combining cognitive science and data science, key features of customer behaviour are identified. ChurnKB's insights on customer feelings and behaviours are used for feature extraction from textual data.  
Figure 3 shows the pipeline for a KB-enhanced churn classifier. The method adopts a scalable, service-oriented architecture, allowing for seamless integration of new analytical features.  
* The first step involves data curation, defined as the process of transforming raw data into contextualised data and knowledge [12], thereby enhancing the efficiency of ML algorithms. Drawing inspiration from two recent studies [12; 75], it is crucial to prepare and curate raw textual data before proceeding with further analysis. The curation process involves three steps: (i) data cleaning, (ii) feature extraction, and (iii) feature enrichment. Customer interactions include communications such as reviews and chat logs in a desired period. Cleaning includes removing punctuation, stop words, and special characters while normalizing text. Next, feature extraction applies part-of-speech tagging, named entity recognition, and keyword identification to capture key linguistic patterns. Finally, Feature enrichment incorporates synonym expansion (e.g., WordNet [76]) and stemming to standardize word forms, enhancing the dataset for churn prediction analysis.
* Each customer feeling and behaviour represented in ChurnKB (e.g., dissatisfaction) may be caused by various reasons (e.g., poor customer service). These reasons, in turn, may lead to several feelings or behaviours (e.g., anger), which are considered sub-instances within ChurnKB. In the second step, as outlined in Algorithm 2, these  
Figure 3: The pipeline for developing a knowledge base-enhanced churn classifier. The process includes the following steps: (1) data curation: preprocessing of customer interactions to extract relevant linguistic features; (2) feature linking: mapping of extracted features to churn-related concepts in the churn knowledge base; (3) score calculation: assigning numerical scores to features; and (4) Classifier development: using these scores as inputs for a churn prediction model validated via expert feedback.  
sub-instances are linked to the curated data and extracted features by initialising an empty list for each instance. Extracted features (e.g., stemmed keywords or phrases) are then added to the corresponding sub-instance list.
* In the third step, the extracted features from the previous step are used as input for the corresponding sub-instance-related APIs, enabling the score calculation process for each sub-instance.
* In the fourth step, the calculated scores are used as input features for the churn classifier. ML algorithms like Random Forest, Logistic Regression, and XGBoost can be applied. The model is trained as a binary classifier to predict if a customer is likely to churn. A feedback loop evaluates the KB's performance, as described in Section 4.1.  
```
Input: Curated input textual data Output: List of features that are linked to the sub-instances of the ChurnKB Extract features from textual data; Churn-related sub-instances = Set up and Array for sub-instances in the ChurnKB; % (e.g., Negative Feedback and Anger, etc.) for Each Churn-related sub-instances do  Generate an empty list; for Each feature in extracted-feature do  Add the feature to the corresponding sub-instance list;  Link extracted features to the sub-instances in ChurnKB; endfor endfor
```  
**Algorithm 2** Linking extracted features from input textual data to the sub-instances in ChurnKB.