Yuki Yada, Tsuneo Matsumoto, Fuyuko Kido, Hayato Yamana
This repository provides the text-based dataset and experimental code for the paper: Why is the User Interface a Dark Pattern? : Explainable Auto-Detection and its Analysis
Accepted at IEEE BigData 2023 (Poster)
Dark patterns are malicious user interface designs that lead users towards specific actions and have been a growing concern in recent years.
This research focused on the interpretable automatic detection of dark patterns, specifically on extracting the reasons why a user interface is determined to be a dark pattern.
First, we constructed an automatic detection model for dark patterns using BERT, based on a dataset obtained from prior research for dark patterns auto detection on E-Commerce sites. Next, we applied LIME and SHAP, which are Post-Hoc interpretation methods for machine learning models, to extract words that influence the determination of a dark pattern.
For more information, please check our paper.
Requirements:
- python ^3.8
- poetry 1.2.1
You can setup project by running:
$ poetry installSet PYTHONPATH to environment variable
$ export PYTHONPATH="$PYTHONPATH:$(pwd)"To train and evaluate dark pattern auto detection model, please run:
$ python experiments/train.pyYou can execute lime-based interpretation of dark pattern auto detection model by:
$ python experiments/explain_by_lime.pyFor shap:
$ python experiments/explain_by_shap.py| Model | Accuracy | AUC | F1 score | Precision | Recall |
|---|---|---|---|---|---|
| 0.958 | 0.991 | 0.959 | 0.949 | ||
| 0.967 | 0.992 | 0.967 | 0.972 | 0.962 | |
| 0.965 | 0.965 | 0.970 | 0.960 | ||
| 0.991 | 0.957 |
We have applied LIME to all instances and visualized the importance scores (Saliency) by coloring them, as shown below:
We applied SHAP to all dark pattern texts. We calculated the average score ranged from 0 to 1, from SHAP and extracted words in descending order based on their average scores. list of the words with high influence scores is below:
| Terms | Scores | |
|---|---|---|
| 1 | 0.769 | |
| 2 | 0.665 | |
| 3 | 0.660 | |
| 4 | 0.576 | |
| 5 | 0.571 | |
| 6 | 0.557 | |
| 7 | 0.528 | |
| 8 | 0.500 | |
| 9 | 0.500 | |
| 10 | 0.500 | |
| 11 | 0.499 | |
| 12 | 0.496 | |
| 13 | 0.490 | |
| 14 | 0.480 | |
| 15 | 0.477 | |
| 16 | 0.467 | |
| 17 | 0.451 | |
| 18 | 0.437 | |
| 19 | 0.427 | |
| 20 | 0.419 | |
| 21 | 0.409 | |
| 22 | 0.386 | |
| 23 | 0.384 | |
| 24 | 0.375 | |
| 25 | 0.345 |