Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Query Classifier Model
|
| 2 |
+
|
| 3 |
+
This is a probabilistic multi-label classifier for routing business queries to appropriate systems.
|
| 4 |
+
|
| 5 |
+
## Model Description
|
| 6 |
+
- **Architecture**: Multi-layer neural network with sigmoid outputs
|
| 7 |
+
- **Input**: TF-IDF vectorized queries (max 500 features)
|
| 8 |
+
- **Output**: Independent probabilities for each system
|
| 9 |
+
- **Systems**: accounting, communication, enterprise_resource_planning, knowledge_management, project_management, sales
|
| 10 |
+
|
| 11 |
+
## Performance
|
| 12 |
+
- **Macro F1**: 0.817
|
| 13 |
+
- **Micro F1**: 0.803
|
| 14 |
+
- **Subset Accuracy**: 0.704
|
| 15 |
+
- **Hamming Loss**: 0.071
|
| 16 |
+
|
| 17 |
+
## Usage
|
| 18 |
+
|
| 19 |
+
```python
|
| 20 |
+
from src.core.services.query_classifier_service import classify_query
|
| 21 |
+
|
| 22 |
+
# Classify a single query
|
| 23 |
+
result = classify_query("show total revenue for last quarter")
|
| 24 |
+
print(f"Top system: {result['top_system']}")
|
| 25 |
+
print(f"Confidence: {result['confidence']:.3f}")
|
| 26 |
+
print(f"All systems: {result['predicted_systems']}")
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
## Training Data
|
| 30 |
+
- **Total queries**: 621
|
| 31 |
+
- **Training samples**: 496
|
| 32 |
+
- **Test samples**: 125
|
| 33 |
+
- **Sources**: Apache Calcite fine-tuning data (Jira, QuickBooks, HubSpot, Gmail, Notion, SAP)
|
| 34 |
+
|
| 35 |
+
## Systems Supported
|
| 36 |
+
- **accounting**: Accounting
|
| 37 |
+
- **communication**: Communication
|
| 38 |
+
- **enterprise_resource_planning**: Enterprise Resource Planning
|
| 39 |
+
- **knowledge_management**: Knowledge Management
|
| 40 |
+
- **project_management**: Project Management
|
| 41 |
+
- **sales**: Sales
|
| 42 |
+
|
| 43 |
+
## Model Files
|
| 44 |
+
- `final_model.pth`: PyTorch model weights and configuration
|
| 45 |
+
- `vectorizer.pkl`: TF-IDF vectorizer for text preprocessing
|
| 46 |
+
- `mlb.pkl`: Multi-label binarizer for label encoding
|
| 47 |
+
- `metadata.json`: Model metadata and performance metrics
|