Adaptive Sentiment Classifier
An improved sentiment analysis model using the adaptive-classifier library, designed for accurate classification of positive, negative, and neutral sentiments with special focus on technical and informational content.
Model Description
This model is based on the adaptive-classifier library and uses DistilBERT as the underlying transformer. It has been specifically trained to properly classify:
- Positive sentiment: Expressions of satisfaction, enthusiasm, approval
- Negative sentiment: Expressions of dissatisfaction, frustration, criticism
- Neutral sentiment: Factual information, questions, technical descriptions
Key Improvements
- β Technical Content: Properly classifies technical descriptions as neutral
- β Questions: Correctly identifies questions as neutral rather than negative
- β Educational Content: Handles informational text appropriately
- β Balanced Training: Uses detailed class descriptions for better embeddings
Training Data
- Primary Dataset: SetFit/tweet_sentiment_extraction (114 examples)
- Training Method: Adaptive classifier with continual learning
- Class Distribution: Balanced training with quality filtering
- Additional Features: Detailed class descriptions for stronger initial embeddings
Performance
- Test Accuracy: 80.0%
- Problematic Cases Resolved: 8/10 challenging examples correctly classified
- Improvement: 100% increase from baseline accuracy
Benchmark Examples
Text | Expected | Predicted | β |
---|---|---|---|
"Granite Guardian 4 is a type of AI model..." | neutral | neutral | β |
"Do you know what Granite Guardian 4 is?" | neutral | neutral | β |
"Learning is a process of gaining knowledge..." | neutral | neutral | β |
"I love this new technology!" | positive | positive | β |
"This is terrible and I hate it." | negative | negative | β |
Usage
Installation
pip install adaptive-classifier
Basic Usage
from adaptive_classifier import AdaptiveClassifier
# Load the model
classifier = AdaptiveClassifier.from_pretrained("MemChainAI/adaptive-sentiment-classifier")
# Make predictions
text = "This is a great product!"
predictions = classifier.predict(text)
# Get top prediction
label, confidence = predictions[0]
print(f"Sentiment: {label} ({confidence:.3f})")
API Integration
This model is designed to work with the MemChain Models API:
import requests
response = requests.post(
"http://localhost:8033/model/sentiment/predict",
json={"text": "Your text here", "k": 3}
)
result = response.json()
Batch Processing
texts = [
"I love this!",
"This is terrible.",
"The system processes data automatically."
]
# Batch prediction
batch_results = classifier.predict_batch(texts)
for i, predictions in enumerate(batch_results):
label, confidence = predictions[0]
print(f"Text {i+1}: {label} ({confidence:.3f})")
Training Methodology
- Class Descriptions: Started with detailed descriptions of each sentiment class
- Quality Examples: Used filtered, high-quality examples from the dataset
- Iterative Training: Added examples gradually with evaluation at each step
- Continual Learning: Leveraged adaptive classifier's continual learning capabilities
Intended Use
- Content Moderation: Analyze user-generated content sentiment
- Customer Feedback: Classify customer reviews and feedback
- Social Media: Monitor social media sentiment
- Technical Documentation: Properly classify technical content as neutral
- Educational Content: Handle informational and educational text appropriately
Limitations
- Optimized for English text
- Best performance on text similar to training data (tweets, reviews, questions)
- May require additional examples for domain-specific terminology
- Performance may vary on very long texts (>200 characters)
Ethical Considerations
- The model should not be used as the sole basis for important decisions
- Bias may exist reflecting the training data
- Regular evaluation and retraining recommended for production use
- Consider cultural and contextual factors when interpreting results
Citation
@misc{adaptive-sentiment-classifier-2025,
title={Adaptive Sentiment Classifier},
author={MemChain AI},
year={2025},
publisher={Hugging Face},
url={https://huggingface.co/MemChainAI/adaptive-sentiment-classifier}
}
License
MIT License - see LICENSE file for details.
Contact
For questions, issues, or contributions, please visit the MemChain AI.
- Downloads last month
- 0
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support
Dataset used to train MemChainAI/adaptive-sentiment-classifier
Evaluation results
- Test Accuracy on SetFit/tweet_sentiment_extractionself-reported0.800