Methodology

The engine follows a practical applied-ML workflow: train from labelled examples, evaluate performance, apply the model to unlabelled data, and return both labels and confidence for human review.

1. Data Preparation

CSV/Excel files are parsed, the text field is selected, labels are normalised to positive, neutral, or negative, and invalid rows are excluded from model training.

2. Text Vectorisation

TF-IDF transforms text into weighted word and phrase features. This keeps the model lightweight and fast enough for routine operational scoring.

3. Model Training

A Logistic Regression classifier learns the relationship between text features and sentiment labels using balanced class weights to reduce bias toward majority classes.

4. Prediction & Export

The trained model labels unlabelled feedback and appends sentiment, confidence, and class probability fields to the original dataset for export.

Domain-Adaptive Learning

The most important design choice is retraining with the user's own labelled examples. Customer experience, NGO beneficiary feedback, product reviews, and support comments use different vocabulary. By allowing retraining, the model becomes more relevant to the organisation's real language instead of relying only on a generic sentiment dictionary.

Evaluation and Human Review

  • Accuracy, precision, recall, and F1 are used after training when labelled validation data is available.
  • Confidence scores are used to route uncertain predictions to human review.
  • Low-confidence records can be corrected and fed back into future training cycles.
  • Category breakdowns help business teams identify product, service, or programme areas driving negative feedback.
Production methodology: deploy the Flask app behind authentication, limit file sizes, validate uploads, log model versions, review low-confidence predictions, and retrain periodically using corrected human labels.