Skip to content

SkyReNewed/AdaptiveSentimentClassifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adaptive Sentiment Classifier

An LSTM-based sentiment classifier that improves through human feedback. When the model is uncertain about a prediction, it asks the user for a label and learns from it in real time.

How It Works

The model starts with 100 labeled movie reviews (50 positive, 50 negative). On new input, it predicts sentiment with a confidence score. If confidence is low or too many words are unknown, it flags uncertainty and asks you to provide the correct label then updates its weights immediately.

Quick Start

pip install -r requirements.txt
python adaptiveSentimentClassifier.py
Enter text (or 'quit'): this movie was absolutely fantastic
Prediction: Positive (confidence: 0.92)

Enter text (or 'quit'): weird confusing nonsensical plot
I'm not sure about: 'weird confusing nonsensical plot'
  (confidence: 0.18, unknown words: 75%)
Positive (1), Negative (0), or 'skip': 0
Learned! 'weird confusing nonsensical plot' -> Negative

Configuration

classifier = AdaptiveSentimentClassifier(
    confidenceThreshold=0.4,  # Below this, ask for a label
    unknownThreshold=0.5,     # Unknown word ratio trigger
    modelDir="model"          # Where to save checkpoints
)

Project Structure

├── adaptiveSentimentClassifier.py        # AdaptiveSentimentClassifier + interactive loop
├── model/               # Auto-created on first run
│   ├── classifier.pt    # Saved model weights & vocab
│   └── newLabels.json   # User-provided labels
├── requirements.txt
├── .gitignore
└── LICENSE

License

MIT

About

A sentiment model that asks when it doesn't know, and remembers when you tell it.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors