File size: 10,811 Bytes
938347a ffc808d 938347a ffc808d 938347a ffc808d 938347a ffc808d 938347a ffc808d 938347a ffc808d 938347a ffc808d 938347a ffc808d 84896f6 ffc808d 84896f6 ffc808d 84896f6 ffc808d 938347a ffc808d 938347a ffc808d 938347a ffc808d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | ---
license: mit
task_categories:
- text-classification
- tabular-classification
language:
- en
- de
- fr
tags:
- erp
- accounting
- gl-classification
- multimodal
- synthetic-data
size_categories:
- n<1K
---
# ERP GL Account Classifier - Dataset
Synthetic ERP transaction data for training multimodal GL account classifiers.
## Dataset Details
- **Total samples**: 942 (659 train / 141 val / 142 test)
- **Classes**: 8 GL accounts
- **Features**: Text (vendor + description), Numerical (amount + log amount), Categorical (department)
- **Generated using**: AWS Bedrock (Amazon Nova Pro)
- **Cost**: $1.40
- **Quality**: 94% pass rate through zero-shot critic
## Quick Start
```python
from datasets import load_dataset
import json
from huggingface_hub import hf_hub_download
# Load dataset
dataset = load_dataset("EHTB/erp-classifier-dataset")
# Load auxiliary files for decoding
scaler_path = hf_hub_download(repo_id="EHTB/erp-classifier-dataset", filename="scaler.json", repo_type="dataset")
vocab_path = hf_hub_download(repo_id="EHTB/erp-classifier-dataset", filename="dept_vocab.json", repo_type="dataset")
with open(scaler_path) as f:
scaler = json.load(f)
with open(vocab_path) as f:
dept_vocab = json.load(f)
print(dataset['train'][0])
```
## Schema Documentation
Each record contains **4 fields**:
### 1. `text` (string)
**Format**: `"[VENDOR] {vendor_name} [DESC] {description}"`
**Example**: `"[VENDOR] Amazon Services Europe [DESC] Dell UltraSharp U2723DE 27 USB-C Monitor"`
**Note**: Price and department are **intentionally excluded** from text. The model must learn to use numerical and categorical features for classification.
### 2. `num_features` (list of 2 floats)
**Format**: `[normalized_amount, normalized_log_amount]`
**What it contains**:
- `num_features[0]`: StandardScaler-normalized `net_amount_eur`
- `num_features[1]`: StandardScaler-normalized `log1p(net_amount_eur)`
**Derivation**:
```python
import numpy as np
# Original transaction
net_amount_eur = 57.33 # EUR
# Create raw features
raw_features = [
net_amount_eur, # 57.33
np.log1p(net_amount_eur) # 4.0661
]
# Normalize using scaler fitted on TRAINING data only
# (Download scaler.json from this dataset)
mean = [345.43, 5.08]
std = [508.62, 1.22]
num_features = (raw_features - mean) / std
# Result: [-0.566, -0.831]
```
**Why two features?**
- Feature 0: Direct amount for learning absolute thresholds (800 EUR boundary)
- Feature 1: Log-transformed amount for balanced gradient descent across price ranges
- Without log: 2000 EUR has 200× more signal than 10 EUR
- With log: log1p(10)=2.40, log1p(500)=6.22, log1p(2000)=7.60 (compressed scale)
**To denormalize** (get original EUR amount):
```python
import numpy as np
normalized = [-0.566, -0.831]
mean = [345.43, 5.08]
std = [508.62, 1.22]
denormalized = (np.array(normalized) * std) + mean
net_amount_eur = denormalized[0] # 57.33 EUR
```
### 3. `dept_id` (integer)
**Department category** encoded as integer.
**Mapping** (see `dept_vocab.json`):
```json
{
"0": "UNK", // Unknown department
"1": "ENG", // Engineering
"2": "FACILITIES", // Facilities management
"3": "HR", // Human Resources
"4": "IT_OPS", // IT Operations
"5": "MARKETING" // Marketing
}
```
**Example**: `dept_id: 4` → IT_OPS
### 4. `label` (integer)
**GL account class** (target variable).
**Mapping**:
```json
{
"0": "GL_6220_IT_PERIPHERALS_OPEX", // IT hardware < 800 EUR
"1": "GL_1400_IT_HARDWARE_CAPEX", // IT hardware >= 800 EUR
"2": "GL_6400_OFFICE_CONSUMABLES", // Office supplies
"3": "GL_6410_FACILITY_PANTRY", // Coffee, snacks
"4": "GL_6150_MARKETING_PROMO", // Promotional materials
"5": "GL_6310_WORKPLACE_SAFETY_ERGONOMICS", // Ergonomic equipment
"6": "GL_6250_TECH_BOOKS_TRAINING", // Books, training
"7": "GL_6450_CLEANING_MAINTENANCE" // Cleaning supplies
}
```
**Example**: `label: 6` → GL_6250_TECH_BOOKS_TRAINING
## Complete Example: Decoding a Record
```python
from datasets import load_dataset
import numpy as np
import json
from huggingface_hub import hf_hub_download
# Load dataset
dataset = load_dataset("EHTB/erp-classifier-dataset")
sample = dataset['train'][0]
# Load scaler and vocabularies
scaler_path = hf_hub_download(repo_id="EHTB/erp-classifier-dataset", filename="scaler.json", repo_type="dataset")
vocab_path = hf_hub_download(repo_id="EHTB/erp-classifier-dataset", filename="dept_vocab.json", repo_type="dataset")
with open(scaler_path) as f:
scaler = json.load(f)
with open(vocab_path) as f:
dept_vocab = json.load(f)
# GL account mapping
LABEL_MAP = {
0: "GL_6220_IT_PERIPHERALS_OPEX",
1: "GL_1400_IT_HARDWARE_CAPEX",
2: "GL_6400_OFFICE_CONSUMABLES",
3: "GL_6410_FACILITY_PANTRY",
4: "GL_6150_MARKETING_PROMO",
5: "GL_6310_WORKPLACE_SAFETY_ERGONOMICS",
6: "GL_6250_TECH_BOOKS_TRAINING",
7: "GL_6450_CLEANING_MAINTENANCE"
}
# Decode the record
print("Raw sample:")
print(sample)
# Denormalize amount
normalized = np.array(sample['num_features'])
denormalized = (normalized * np.array(scaler['scale'])) + np.array(scaler['mean'])
net_amount_eur = denormalized[0]
# Decode department
id2dept = {int(k): v for k, v in dept_vocab['id2dept'].items()}
department = id2dept[sample['dept_id']]
# Decode GL account
gl_account = LABEL_MAP[sample['label']]
print("\nDecoded sample:")
print(f" Text: {sample['text']}")
print(f" Amount: {net_amount_eur:.2f} EUR")
print(f" Department: {department}")
print(f" GL Account: {gl_account}")
```
## Files in This Dataset
### 📊 Derived Data (Machine Learning Ready)
Use these for training models. Features are pre-processed, normalized, and split.
| File | Records | Description |
|------|---------|-------------|
| `train.jsonl` | 659 | Training split (70%) - normalized features, integer labels |
| `validation.jsonl` | 141 | Validation split (15%) - for hyperparameter tuning |
| `test.jsonl` | 142 | Test split (15%) - for final evaluation |
**Format**: Each record contains:
- `text`: `"[VENDOR] ... [DESC] ..."`
- `num_features`: `[normalized_amount, normalized_log_amount]` (requires `scaler.json` to denormalize)
- `dept_id`: Integer (requires `dept_vocab.json` to decode)
- `label`: Integer 0-7 (see schema documentation for GL account mapping)
### 📁 Source Data (Human Readable)
Use this for exploration, debugging, or regenerating features with different preprocessing.
| File | Records | Description |
|------|---------|-------------|
| `03_filtered.jsonl` | 942 | **All data before train/val/test split** - human-readable strings, raw EUR amounts |
**Format**: Each record contains:
- `vendor`: String (e.g., "AMZN Mktp DE")
- `description`: String (full product description)
- `department`: String (e.g., "MARKETING", "IT_OPS")
- `net_amount_eur`: Float (raw amount, e.g., 483.77)
- `gl_account`: String (e.g., "GL_6150_MARKETING_PROMO")
- `language`: String ("EN", "DE", "FR")
- `text_style`: String (generation style)
- `corrupted`: Boolean (whether ERP corruption was applied)
- `corruption_types`: List of corruption types applied
- `critic_confidence`: String ("high", "medium")
- `critic_reasoning`: String (critic's explanation)
- Plus: `seed_id`, `base_category`, `title`, `asin`, `predicted_gl`, `matches_label`
### 🔧 Auxiliary Files
| File | Description |
|------|-------------|
| `scaler.json` | StandardScaler parameters (mean=[345.43, 5.08], std=[508.62, 1.22]) fitted on training data only |
| `dept_vocab.json` | Department string ↔ integer mapping (6 departments) |
| `evaluation/confusion_matrix.png` | Test set confusion matrix (90.8% accuracy) |
| `evaluation/evaluation_summary.json` | Per-class precision, recall, F1 scores |
### 🔄 Source vs. Derived: When to Use Each
**Use SOURCE (`03_filtered.jsonl`) when you want to:**
- 🔍 Explore the data ("What does a typical MARKETING_PROMO item look like?")
- 🐛 Debug data quality issues
- 🔄 Regenerate features with different normalization (MinMaxScaler, RobustScaler, etc.)
- 📊 Analyze original EUR amounts without denormalization
- 📚 Study data generation metadata (language, style, critic scores)
- 🎯 Create custom train/val/test splits (e.g., 80/10/10 instead of 70/15/15)
- 🔬 Filter by language, corruption type, or critic confidence
**Use DERIVED (`train/val/test.jsonl`) when you want to:**
- 🤖 Train a model immediately (features are pre-processed)
- 🔬 Reproduce published results (exact splits used in paper)
- 📦 Use HuggingFace `datasets` library directly
- ⚡ Fast iteration (no preprocessing pipeline needed)
- 🎓 Follow standard ML workflow (pre-split, normalized data)
## GL Accounts (8 Classes)
The dataset covers 8 GL accounts with a special **800 EUR capitalization threshold** for IT hardware:
| GL Code | Category | Rule |
|---------|----------|------|
| GL_6220 | IT Peripherals (OPEX) | IT hardware **< 800 EUR** |
| GL_1400 | IT Hardware (CAPEX) | IT hardware **≥ 800 EUR** |
| GL_6400 | Office Consumables | Toner, paper, binders, office supplies |
| GL_6410 | Facility Pantry | Coffee, snacks, beverages |
| GL_6150 | Marketing Promo | Promotional materials, swag |
| GL_6310 | Workplace Safety/Ergonomics | Ergonomic equipment, safety gear |
| GL_6250 | Tech Books/Training | Books, courses, training materials |
| GL_6450 | Cleaning/Maintenance | Cleaning supplies, maintenance items |
**The 800 EUR problem**: A €750 monitor and an €850 monitor are the same item, but different accounting treatment. This is why the model needs direct access to numerical features—text classifiers cannot learn mathematical thresholds from tokens.
## Model Performance
A multimodal classifier (DistilBERT + numerical projection + dept embeddings) trained on this dataset achieves:
- **Test accuracy**: 90.8%
- **Test F1**: 90.6%
- **800 EUR threshold accuracy**: 73.5% (GL_6220 classification for items < 800 EUR)
See [EHTB/erp-classifier](https://huggingface.co/EHTB/erp-classifier) for the trained model.
## Data Generation Process
1. **Seed Generation**: Combinatorial specs (vendor × dept × language × style × price)
2. **Verbalization**: Amazon Nova Pro generates realistic product descriptions
3. **Corruption**: SAP 40-char truncation, PO prefixes, OCR errors
4. **Critic**: Zero-shot quality filter (94% pass rate)
5. **Multimodal Transformation**: Extract text, normalize numerical features, encode departments
## Citation
```bibtex
@misc{erp-classifier-dataset,
title={ERP GL Account Classifier Dataset},
author={EHTB},
year={2024},
publisher={HuggingFace},
howpublished={\url{https://huggingface.co/datasets/EHTB/erp-classifier-dataset}}
}
```
## License
MIT
|