The nine variables I focused on in my analysis are Empathy, Convenience, Price Sensitivity, Physical Environment, Perceived Product Quality, Customer Trust, Perceived Value, Purchase Intention, and Regular Customer. The dataset used for this project is the Subsentence retail dataset in data in brief: Dataset.
The following relationships exist according to the heatmap:
Physical Environment and Customer Trust
Physical Environment and Convenience
Physical Environment and Perceived Product Quality
Customer Trust and Empathy
Customer Trust and Convenience
Customer Trust and Perceived Product Quality
Perceived Product Quality and Perceived Value
Perceived Value and Purchase Intention
Customer Trust and Price Sensitivity
Customer Trust and Purchase Intention
Price Sensitivity and Purchase Intention
Convenience and Perceived Value
Regular Customer and Physical Environment
Regular Customer and Convenience
I first had to define the edges of the DAG, these edges were interpreted from the heatmap to build relationships.
The bnlearn library was used with the function of bn.structure_learning.fit() to learn the structure of the Bayesian network from the dataset. The structure learning method I used was Hill climb search which estimates a DAG structure that improves the network structure. The score type I used was the Akaike Information Criterion (AIC) which is a scoring function to evaluate the network structure on how well the data fits the model.
An evaluation metric and a visualisation will be provided below to illustrate the results:
3 Measures were calculated to evaluate the comparison of the DAGs namely precision (0.91), recall (0.87) and f1-score (0.89).
Precision measures the proportion of true positives compared to all positive predictions (TP AND FP). A high precision score is preferred. In this case, the precision is quite high at 91%.
Recall measures the proportion of the true positive compared to the sum of the TP and the FN, a high score is preferred. In this case, the Recall is high with a score of 87%.
F1-Score is a metric that balances the score of precision and recall. A high score is preferred, and in this case, the score is quite high with 89%.