tmutton commited on
Commit
0e55a4f
·
1 Parent(s): e0cfb62

Add dataset card

Browse files
Files changed (1) hide show
  1. README.md +171 -0
README.md ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - text-classification
5
+ language:
6
+ - en
7
+ tags:
8
+ - accessibility
9
+ - wcag
10
+ - text-classification
11
+ - distilbert
12
+ size_categories:
13
+ - n<1K
14
+ ---
15
+
16
+ # WCAG Accessibility Issues
17
+
18
+ A small synthetic dataset for experimenting with machine learning classification of accessibility defects against WCAG success criteria.
19
+
20
+ This project was created as a learning exercise to explore the complete Hugging Face text-classification workflow, including dataset preparation, tokenisation, fine-tuning a pretrained Transformer model, evaluation and inference.
21
+
22
+ ## Dataset
23
+
24
+ The dataset contains **100 synthetic accessibility defect descriptions** across five WCAG success criteria.
25
+
26
+ Each class contains 20 examples.
27
+
28
+ | Label | WCAG success criterion |
29
+ |---|---|
30
+ | 0 | 1.3.1 Info and Relationships |
31
+ | 1 | 2.1.1 Keyboard |
32
+ | 2 | 2.4.3 Focus Order |
33
+ | 3 | 2.4.7 Focus Visible |
34
+ | 4 | 4.1.2 Name, Role, Value |
35
+
36
+ Example:
37
+
38
+ ```text
39
+ Custom radio control does not expose its selected state
40
+ ```
41
+
42
+ Label:
43
+
44
+ ```text
45
+ 4.1.2 Name, Role, Value
46
+ ```
47
+
48
+ All examples are synthetic and were created specifically for this project. The dataset does not contain real audit findings or customer data.
49
+
50
+ ## Dataset Splits
51
+
52
+ The 100 examples are divided using a stratified split:
53
+
54
+ | Split | Examples | Examples per class |
55
+ |---|---:|---:|
56
+ | Training | 80 | 16 |
57
+ | Validation | 10 | 2 |
58
+ | Test | 10 | 2 |
59
+
60
+ The original complete dataset is available in `data.csv`.
61
+
62
+ `split_data.py` can be used to reproduce the train, validation and test datasets.
63
+
64
+ ## Model Training
65
+
66
+ The project uses `distilbert-base-uncased` as the pretrained base model.
67
+
68
+ DistilBERT is fine-tuned for multiclass sequence classification with five output classes corresponding to the five WCAG success criteria.
69
+
70
+ The training configuration currently uses:
71
+
72
+ - 5 epochs
73
+ - Batch size of 8
74
+ - Learning rate of 2e-5
75
+ - Validation after each epoch
76
+ - Weighted F1 as the model-selection metric
77
+
78
+ The training process is implemented in `train_model.py`.
79
+
80
+ ## Initial Results
81
+
82
+ The initial model achieved:
83
+
84
+ | Metric | Result |
85
+ |---|---:|
86
+ | Test accuracy | 80% |
87
+ | Weighted precision | 0.867 |
88
+ | Weighted recall | 0.800 |
89
+ | Weighted F1 | 0.787 |
90
+
91
+ These results are based on a test set containing only **10 examples** and should not be interpreted as evidence that the model will achieve 80% accuracy on real-world accessibility defects.
92
+
93
+ The results demonstrate that the end-to-end classification pipeline is working.
94
+
95
+ ## Example Predictions
96
+
97
+ After fine-tuning, the model correctly classified previously unseen examples such as:
98
+
99
+ ```text
100
+ no focus indicator
101
+ ```
102
+
103
+ as:
104
+
105
+ ```text
106
+ 2.4.7 Focus Visible
107
+ ```
108
+
109
+ and:
110
+
111
+ ```text
112
+ can't open menu with keyboard
113
+ ```
114
+
115
+ as:
116
+
117
+ ```text
118
+ 2.1.1 Keyboard
119
+ ```
120
+
121
+ ## Repository Files
122
+
123
+ - `data.csv` — complete synthetic dataset
124
+ - `train.csv` — training split
125
+ - `validation.csv` — validation split
126
+ - `test.csv` — held-out test split
127
+ - `split_data.py` — creates the stratified dataset splits
128
+ - `load_dataset.py` — loads the CSV files using Hugging Face Datasets
129
+ - `tokenize_dataset.py` — tokenises examples and encodes labels
130
+ - `load_model.py` — loads DistilBERT for sequence classification
131
+ - `train_model.py` — fine-tunes and evaluates the classifier
132
+ - `predict.py` — performs inference using the trained model
133
+
134
+ ## Limitations
135
+
136
+ This is a small educational dataset rather than a production accessibility dataset.
137
+
138
+ In particular:
139
+
140
+ - Only five WCAG success criteria are represented.
141
+ - The examples are synthetic.
142
+ - There are only 20 examples per class.
143
+ - The test set contains only 10 examples.
144
+ - Real accessibility defects may be substantially more complex or ambiguous.
145
+ - Some accessibility defects can relate to more than one WCAG success criterion.
146
+
147
+ The classifier is a closed-set classifier. It must select one of its five known classes even when an issue actually belongs to a WCAG criterion that is not represented in the dataset.
148
+
149
+ For example, an issue concerning missing alternative text would normally relate to **1.1.1 Non-text Content**, but the current model has no 1.1.1 class available.
150
+
151
+ ## Purpose
152
+
153
+ The purpose of this project is to learn and demonstrate an end-to-end Hugging Face machine learning workflow:
154
+
155
+ ```text
156
+ Dataset
157
+ ↓
158
+ Train / Validation / Test Split
159
+ ↓
160
+ Tokenisation
161
+ ↓
162
+ Pretrained DistilBERT
163
+ ↓
164
+ Fine-tuning
165
+ ↓
166
+ Evaluation
167
+ ↓
168
+ Inference
169
+ ```
170
+
171
+ The project can be extended by adding more examples, introducing additional WCAG success criteria and evaluating the resulting classifier against a larger and more representative test dataset.