Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
@@ -12,29 +12,27 @@ license: apache-2.0
|
|
12 |
|
13 |
A flexible, adaptive classification system that allows for dynamic addition of new classes and continuous learning from examples. Built on top of transformers from HuggingFace, this library provides an easy-to-use interface for creating and updating text classifiers.
|
14 |
|
15 |
-
##
|
16 |
|
17 |
-
|
18 |
-
- π Continuous learning capabilities
|
19 |
-
- π― Dynamic class addition
|
20 |
-
- πΎ Safe and efficient state persistence
|
21 |
-
- π Prototype-based learning
|
22 |
-
- π§ Neural adaptation layer
|
23 |
-
|
24 |
-
## Try Now
|
25 |
-
|
26 |
-
| Use Case | Demonstrates | Link |
|
27 |
-
|----------|----------|-------|
|
28 |
-
| Basic Example (Cat or Dog) | Continuous learning | [](https://colab.research.google.com/drive/1Zmvtb3XUFtUImEmYdKpkuqmxKVlRxzt9?usp=sharing) |
|
29 |
-
| Support Ticket Classification| Realistic examples | [](https://colab.research.google.com/drive/1yeVCi_Cdx2jtM7HI0gbU6VlZDJsg_m8u?usp=sharing) |
|
30 |
-
| Query Classification | Different configurations | [](https://colab.research.google.com/drive/1b2q303CLDRQAkC65Rtwcoj09ovR0mGwz?usp=sharing) |
|
31 |
-
| Multilingual Sentiment Analysis | Ensemble of classifiers | [](https://colab.research.google.com/drive/14tfRi_DtL-QgjBMgVRrsLwcov-zqbKBl?usp=sharing) |
|
32 |
-
| Product Category Classification | Batch processing | [](https://colab.research.google.com/drive/1VyxVubB8LXXES6qElEYJL241emkV_Wxc?usp=sharing) |
|
33 |
-
|
34 |
-
## Installation
|
35 |
-
|
36 |
-
```bash
|
37 |
pip install adaptive-classifier
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
```
|
39 |
|
40 |
## How It Works
|
@@ -46,25 +44,3 @@ The system combines three key components:
|
|
46 |
2. **Prototype Memory**: Maintains class prototypes for quick adaptation to new examples
|
47 |
|
48 |
3. **Adaptive Neural Layer**: Learns refined decision boundaries through continuous training
|
49 |
-
|
50 |
-
## References
|
51 |
-
|
52 |
-
- [RouteLLM: Learning to Route LLMs with Preference Data](https://arxiv.org/abs/2406.18665)
|
53 |
-
- [Transformer^2: Self-adaptive LLMs](https://arxiv.org/abs/2501.06252)
|
54 |
-
- [Lamini Classifier Agent Toolkit](https://www.lamini.ai/blog/classifier-agent-toolkit)
|
55 |
-
- [Protoformer: Embedding Prototypes for Transformers](https://arxiv.org/abs/2206.12710)
|
56 |
-
- [Overcoming catastrophic forgetting in neural networks](https://arxiv.org/abs/1612.00796)
|
57 |
-
|
58 |
-
## Citation
|
59 |
-
|
60 |
-
If you use this library in your research, please cite:
|
61 |
-
|
62 |
-
```bibtex
|
63 |
-
@software{adaptive_classifier,
|
64 |
-
title = {Adaptive Classifier: Dynamic Text Classification with Continuous Learning},
|
65 |
-
author = {Asankhaya Sharma},
|
66 |
-
year = {2025},
|
67 |
-
publisher = {GitHub},
|
68 |
-
url = {https://github.com/codelion/adaptive-classifier}
|
69 |
-
}
|
70 |
-
```
|
|
|
12 |
|
13 |
A flexible, adaptive classification system that allows for dynamic addition of new classes and continuous learning from examples. Built on top of transformers from HuggingFace, this library provides an easy-to-use interface for creating and updating text classifiers.
|
14 |
|
15 |
+
## Usage
|
16 |
|
17 |
+
```python
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
pip install adaptive-classifier
|
19 |
+
|
20 |
+
from adaptive_classifier import AdaptiveClassifier
|
21 |
+
# Load from Hub
|
22 |
+
classifier = AdaptiveClassifier.from_pretrained("adaptive-classifier/model-name")
|
23 |
+
# Add some examples
|
24 |
+
texts = [
|
25 |
+
"The product works great!",
|
26 |
+
"Terrible experience",
|
27 |
+
"Neutral about this purchase"
|
28 |
+
]
|
29 |
+
labels = ["positive", "negative", "neutral"]
|
30 |
+
|
31 |
+
classifier.add_examples(texts, labels)
|
32 |
+
|
33 |
+
# Make predictions
|
34 |
+
predictions = classifier.predict("This is amazing!")
|
35 |
+
print(predictions) # [('positive', 0.85), ('neutral', 0.12), ('negative', 0.03)]
|
36 |
```
|
37 |
|
38 |
## How It Works
|
|
|
44 |
2. **Prototype Memory**: Maintains class prototypes for quick adaptation to new examples
|
45 |
|
46 |
3. **Adaptive Neural Layer**: Learns refined decision boundaries through continuous training
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|