Add vendor-classification
Browse files- README.md +76 -0
- config.json +50 -0
- examples.json +0 -0
- model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: multilingual
|
| 3 |
+
tags:
|
| 4 |
+
- adaptive-classifier
|
| 5 |
+
- text-classification
|
| 6 |
+
- continuous-learning
|
| 7 |
+
license: apache-2.0
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Adaptive Classifier
|
| 11 |
+
|
| 12 |
+
This model is an instance of an [adaptive-classifier](https://github.com/codelion/adaptive-classifier) that allows for continuous learning and dynamic class addition.
|
| 13 |
+
|
| 14 |
+
You can install it with `pip install adaptive-classifier`.
|
| 15 |
+
|
| 16 |
+
## Model Details
|
| 17 |
+
|
| 18 |
+
- Base Model: answerdotai/ModernBERT-base
|
| 19 |
+
- Number of Classes: 5
|
| 20 |
+
- Total Examples: 400
|
| 21 |
+
- Embedding Dimension: 768
|
| 22 |
+
|
| 23 |
+
## Class Distribution
|
| 24 |
+
|
| 25 |
+
```
|
| 26 |
+
blacklisted: 80 examples (20.0%)
|
| 27 |
+
established_vendor: 80 examples (20.0%)
|
| 28 |
+
high_risk: 80 examples (20.0%)
|
| 29 |
+
new_vendor: 80 examples (20.0%)
|
| 30 |
+
trusted_partner: 80 examples (20.0%)
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
## Usage
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
from adaptive_classifier import AdaptiveClassifier
|
| 37 |
+
|
| 38 |
+
# Load the model
|
| 39 |
+
classifier = AdaptiveClassifier.from_pretrained("adaptive-classifier/model-name")
|
| 40 |
+
|
| 41 |
+
# Make predictions
|
| 42 |
+
text = "Your text here"
|
| 43 |
+
predictions = classifier.predict(text)
|
| 44 |
+
print(predictions) # List of (label, confidence) tuples
|
| 45 |
+
|
| 46 |
+
# Add new examples
|
| 47 |
+
texts = ["Example 1", "Example 2"]
|
| 48 |
+
labels = ["class1", "class2"]
|
| 49 |
+
classifier.add_examples(texts, labels)
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
## Training Details
|
| 53 |
+
|
| 54 |
+
- Training Steps: 13
|
| 55 |
+
- Examples per Class: See distribution above
|
| 56 |
+
- Prototype Memory: Active
|
| 57 |
+
- Neural Adaptation: Active
|
| 58 |
+
|
| 59 |
+
## Limitations
|
| 60 |
+
|
| 61 |
+
This model:
|
| 62 |
+
- Requires at least 3 examples per class
|
| 63 |
+
- Has a maximum of 150 examples per class
|
| 64 |
+
- Updates prototypes every 10 examples
|
| 65 |
+
|
| 66 |
+
## Citation
|
| 67 |
+
|
| 68 |
+
```bibtex
|
| 69 |
+
@software{adaptive_classifier,
|
| 70 |
+
title = {Adaptive Classifier: Dynamic Text Classification with Continuous Learning},
|
| 71 |
+
author = {Sharma, Asankhaya},
|
| 72 |
+
year = {2025},
|
| 73 |
+
publisher = {GitHub},
|
| 74 |
+
url = {https://github.com/codelion/adaptive-classifier}
|
| 75 |
+
}
|
| 76 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"config": {
|
| 3 |
+
"batch_size": 16,
|
| 4 |
+
"cost_coefficients": {},
|
| 5 |
+
"cost_function_type": "separable",
|
| 6 |
+
"device_map": "auto",
|
| 7 |
+
"early_stopping_patience": 3,
|
| 8 |
+
"enable_strategic_mode": false,
|
| 9 |
+
"epochs": 10,
|
| 10 |
+
"ewc_lambda": 100.0,
|
| 11 |
+
"gradient_checkpointing": false,
|
| 12 |
+
"learning_rate": 2e-05,
|
| 13 |
+
"max_examples_per_class": 150,
|
| 14 |
+
"max_length": 512,
|
| 15 |
+
"min_confidence": 0.1,
|
| 16 |
+
"min_examples_per_class": 3,
|
| 17 |
+
"neural_weight": 0.4,
|
| 18 |
+
"num_representative_examples": 5,
|
| 19 |
+
"prototype_update_frequency": 10,
|
| 20 |
+
"prototype_weight": 0.6,
|
| 21 |
+
"quantization": null,
|
| 22 |
+
"similarity_threshold": 0.7,
|
| 23 |
+
"strategic_blend_regular_weight": 0.6,
|
| 24 |
+
"strategic_blend_strategic_weight": 0.4,
|
| 25 |
+
"strategic_lambda": 0.1,
|
| 26 |
+
"strategic_prediction_head_weight": 0.5,
|
| 27 |
+
"strategic_prediction_proto_weight": 0.5,
|
| 28 |
+
"strategic_robust_head_weight": 0.2,
|
| 29 |
+
"strategic_robust_proto_weight": 0.8,
|
| 30 |
+
"strategic_training_frequency": 10,
|
| 31 |
+
"warmup_steps": 0
|
| 32 |
+
},
|
| 33 |
+
"embedding_dim": 768,
|
| 34 |
+
"id_to_label": {
|
| 35 |
+
"0": "new_vendor",
|
| 36 |
+
"1": "established_vendor",
|
| 37 |
+
"2": "trusted_partner",
|
| 38 |
+
"3": "high_risk",
|
| 39 |
+
"4": "blacklisted"
|
| 40 |
+
},
|
| 41 |
+
"label_to_id": {
|
| 42 |
+
"blacklisted": 4,
|
| 43 |
+
"established_vendor": 1,
|
| 44 |
+
"high_risk": 3,
|
| 45 |
+
"new_vendor": 0,
|
| 46 |
+
"trusted_partner": 2
|
| 47 |
+
},
|
| 48 |
+
"model_name": "answerdotai/ModernBERT-base",
|
| 49 |
+
"train_steps": 13
|
| 50 |
+
}
|
examples.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7de0dc8b8270f483f76564a7170bc300713e79183818988e4896772757f9b6ec
|
| 3 |
+
size 3567620
|