|
Download README.md from EHTB/erp-classifier-dataset: direct link, hf CLI and curl.
- Browser
- Download file 10.8 kB
-
https://huggingface.co/datasets/EHTB/erp-classifier-dataset/resolve/main/README.md
- Command line
-
hf download hf://datasets/EHTB/erp-classifier-dataset/README.md
-
curl -L -o README.md https://huggingface.co/datasets/EHTB/erp-classifier-dataset/resolve/main/README.md
10.8 kB
| 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 | |