Detecting Malicious Dark Pattern Codes Using SHAP (Shapley Additive Explanations) Feature Engineering
摘要
Understanding how dark patterns influence user sentiment is crucial for developing ethical and user-friendly digital experiences. This study evaluates the performance of XGBoost and Random Forest in predicting sentiment (negative, neutral, or positive) based on user interactions. The models were assessed using accuracy, precision, recall, and F1-score, with results indicating that XGBoost outperforms Random Forest, achieving an accuracy of 88.4% compared to 85.9%. To enhance interpretability, SHAP (Shapley Additive Explanations) was used to break down model predictions and identify the most influential features. The analysis revealed that “Number of Clicks” and “Time Spent on Page” were the strongest indicators of user sentiment, particularly in detecting frustration associated with dark patterns. The results provide valuable insights into how machine learning models interpret user engagement and emphasize the importance of transparent AI-driven sentiment analysis. By leveraging explainable AI techniques like SHAP, this research contributes to improving trust in sentiment classification models and guiding the development of more user-centric digital interfaces.