File size: 3,074 Bytes
8a578ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
base_model: distilbert-base-uncased
tags:
- text-classification
- tabular-classification
- multimodal
- erp
- accounting
- pytorch
pipeline_tag: text-classification
widget:
- text: "[VENDOR] Amazon Services [DESC] Dell UltraSharp 27 USB-C Monitor"
---

# ERP GL Account Classifier

Multimodal classifier for ERP GL account classification. Achieves **90.8% test accuracy** by learning from:
- Text: vendor + description
- Numerical: transaction amount + log(amount)
- Categorical: department embeddings

## Model Details

- **Base model**: DistilBERT (distilbert-base-uncased)
- **Architecture**: 3-branch fusion (text 768-d + numerical 64-d + categorical 32-d)
- **Parameters**: 66.6M (all trainable)
- **Training data**: 659 samples (synthetic ERP transactions)
- **Test accuracy**: 90.8%
- **Test F1**: 90.6%

## Usage

```python
import json
import numpy as np
import torch
from pathlib import Path
from transformers import AutoTokenizer, AutoConfig
from huggingface_hub import hf_hub_download

# Download auxiliary files
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_params = json.load(f)
    scaler_mean = np.array(scaler_params['mean'])
    scaler_scale = np.array(scaler_params['scale'])

with open(vocab_path) as f:
    dept_vocab = json.load(f)['dept2id']

# Load model (requires custom ERPClassifierModel class)
# See: https://github.com/yourusername/erp-classifier/blob/main/src/model.py

tokenizer = AutoTokenizer.from_pretrained("EHTB/erp-classifier")
config = AutoConfig.from_pretrained("EHTB/erp-classifier")

# Note: This model uses a custom architecture (ERPClassifierModel).
# You need to import the model class from the repository to load weights.
```

## Training Procedure

- **Optimizer**: AdamW (lr=3e-5, weight_decay=0.01)
- **Warmup**: 10% of training steps
- **Batch size**: 16
- **Epochs**: 10 (early stopping patience=5)
- **Loss**: CrossEntropyLoss
- **Training time**: ~3 minutes (Apple M1/M2)

## Performance

| GL Account | F1 Score | Support |
|------------|----------|---------|
| GL_6410_FACILITY_PANTRY | 100% | 18 |
| GL_6450_CLEANING_MAINTENANCE | 100% | 19 |
| GL_6400_OFFICE_CONSUMABLES | 96.8% | 15 |
| GL_6250_TECH_BOOKS_TRAINING | 95.0% | 19 |
| GL_6150_MARKETING_PROMO | 94.1% | 18 |
| GL_6310_WORKPLACE_SAFETY_ERGONOMICS | 91.9% | 19 |
| GL_1400_IT_HARDWARE_CAPEX | 79.1% | 19 |
| GL_6220_IT_PERIPHERALS_OPEX | 64.0% | 15 |

## Limitations

- Trained on synthetic data (942 samples)
- GL_6220 (IT peripherals < 800 EUR) has lower accuracy due to limited training examples
- Requires custom model class (not compatible with standard AutoModelForSequenceClassification)

## Citation

```bibtex
@misc{erp-classifier,
  title={ERP GL Account Classifier},
  author={Your Name},
  year={2024},
  publisher={HuggingFace},
  howpublished={\url{https://huggingface.co/EHTB/erp-classifier}}
}
```