How amritkaur15/sentiment-classifier works
1. Repository shape
- This is a small, notebook-driven machine learning project, not an application with multiple services.
- The architecture is centered on one Jupyter notebook, one labeled dataset, and a few generated analysis artifacts.
2. Primary entry point
- sentiment_classifier.ipynb is the main workflow.
- It likely contains the full pipeline: data loading, text cleaning, feature extraction, model training, evaluation, and inspection of the most influential words.
3. Data source
- IMDB Dataset.csv is the core input asset.
- It provides the labeled text examples used to train and test the classifier, so the dataset is the main boundary between raw data and the modeling pipeline.
4. Modeling pipeline
- The README states the model uses TF-IDF + Logistic Regression via scikit-learn.
- Architecturally, this means text is converted into sparse numeric features first, then a linear classifier learns sentiment boundaries from those features.
5. Text processing boundary
- The project likely includes standard preprocessing in the notebook, but the key architectural point is that all text handling remains inside the notebook workflow.
- There is no separate preprocessing service, API, or batch job; the notebook owns the full transformation path from raw review text to model-ready vectors.
6. Training and evaluation flow
- The training flow is: load CSV → split data → vectorize text with TF-IDF → fit logistic regression → evaluate on held-out data.
- The evaluation output is summarized as accuracy and a confusion matrix, which are the main quality checkpoints for the classifier.
7. Model interpretability
- The “Top Predictive Words” section indicates the notebook extracts feature weights from the linear model.
- This is an important architectural advantage of logistic regression: the model can be inspected directly to identify positive and negative sentiment indicators.
8. Generated artifacts
- confusion_matrix.png is referenced in the README as a generated output, even though it is not shown in the file tree.
- This suggests the notebook produces visual reporting artifacts alongside the trained model results, but likely does not persist a reusable model file in the repository.
9. Runtime and tooling
- The project depends on Python 3.11 and common scientific Python libraries: pandas, numpy, scikit-learn, matplotlib, and Jupyter.
- requirements.txt exists to capture these dependencies, while the README provides manual setup steps for an interactive notebook environment.
10. Operational model
- The repository is intended for interactive, local execution rather than deployment.
- There is no evidence of a serving layer, database, message queue, or cloud infrastructure; the notebook is the entire execution environment.
11. Architectural boundary summary
- Input boundary: labeled IMDB reviews from CSV.
- Processing boundary: TF-IDF feature generation and logistic regression training inside the notebook.
- Output boundary: evaluation metrics, confusion matrix image, and ranked sentiment-bearing words.
12. What to draw in an architecture diagram
- A simple left-to-right flow is appropriate: dataset file → notebook pipeline → trained classifier/evaluation outputs.
- The only significant external dependency is the Python/scikit-learn/Jupyter runtime; everything else is local and self-contained.
Main entry points: sentiment_classifier.ipynb Notebook · IMDB Dataset.csv IMDB Dataset.csv
Components 7
Other components
- IMDB Dataset.csv · Core input corpus of reviews and sentiment labels.
IMDB Dataset.csv - Notebook · Main interactive pipeline that owns loading, preprocessing, training, and inspection.
sentiment_classifier.ipynb - Text prep · Notebook-internal text normalization and train/test split before feature extraction.
sentiment_classifier.ipynb - TF-IDF · Converts reviews into sparse numerical vectors for linear modeling.
sentiment_classifier.ipynb - Logistic regression · Learns the sentiment decision boundary from TF-IDF features.
sentiment_classifier.ipynb - Evaluation · Produces accuracy, confusion matrix, and other quality checks from held-out predictions.
sentiment_classifier.ipynb - Top words · Extracts influential positive and negative terms from model coefficients.
sentiment_classifier.ipynb
Connections 8
- IMDB Dataset.csv → Notebook: loaded by · CSV reviews and labels are read into the notebook workflow.
- Notebook → Text prep: runs · The notebook performs preprocessing and splitting steps.
- Text prep → TF-IDF: transforms to · Cleaned text is vectorized into sparse features.
- TF-IDF → Logistic regression: trains · TF-IDF vectors feed the sentiment classifier.
- Logistic regression → Evaluation: scores · Predictions are evaluated on held-out data.
- Logistic regression → Top words: explains · Model weights are inspected to surface predictive words.
- Evaluation → Notebook: reported in · Metrics and confusion matrix are presented in the notebook.
- Top words → Notebook: reported in · Top words analysis is displayed in the notebook.