Update README.md
Browse files
README.md
CHANGED
|
@@ -2,4 +2,35 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
datasets:
|
| 4 |
- Hcompany/WebClick
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
datasets:
|
| 4 |
- Hcompany/WebClick
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
## ID2Label Testing
|
| 10 |
+
|
| 11 |
+
```py
|
| 12 |
+
%%capture
|
| 13 |
+
!pip install datasets==3.2.0
|
| 14 |
+
```
|
| 15 |
+
|
| 16 |
+
```py
|
| 17 |
+
from datasets import load_dataset
|
| 18 |
+
|
| 19 |
+
# Load the dataset
|
| 20 |
+
dataset = load_dataset("Hcompany/WebClick")
|
| 21 |
+
|
| 22 |
+
# Extract unique masterCategory values (assuming it's a string field)
|
| 23 |
+
labels = sorted(set(example["bucket"] for example in dataset["test"]))
|
| 24 |
+
|
| 25 |
+
# Create id2label mapping
|
| 26 |
+
id2label = {str(i): label for i, label in enumerate(labels)}
|
| 27 |
+
|
| 28 |
+
# Print the mapping
|
| 29 |
+
print(id2label)
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
```
|
| 33 |
+
{'0': 'agentbrowse', '1': 'calendars', '2': 'humanbrowse'}
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
---
|