How minahilirfan98/datascience-ai works
This repository includes coursework materials and a small Twitter sentiment-analysis application. Its user workflow is: enter tweet text in Gradio, preprocess it, transform it with the saved TF-IDF vectorizer, classify it with the saved Logistic Regression model, then display a sentiment label and confidence. A separate training script prepares data, trains and evaluates the model, and saves the two artifacts. The training CSV is referenced by the script but is absent from the tree; the README is empty.
Main entry points: app.py Prediction handler · trainmodel.py Training workflow · model.pkl Model artifact · vectorizer.pkl Vectorizer artifact
Components 17
Model training
- Training CSV
- Training workflow
twitter-sentiment-analysis/trainmodel.py - Text cleaning
twitter-sentiment-analysis/trainmodel.py - TF-IDF fitting
twitter-sentiment-analysis/trainmodel.py - Train-test split
twitter-sentiment-analysis/trainmodel.py - Logistic regression
twitter-sentiment-analysis/trainmodel.py - Model evaluation
twitter-sentiment-analysis/trainmodel.py - Model artifact
twitter-sentiment-analysis/model.pkl - Vectorizer artifact
twitter-sentiment-analysis/vectorizer.pkl
Prediction
- Prediction handler
twitter-sentiment-analysis/app.py - Text cleaning
twitter-sentiment-analysis/app.py - TF-IDF transform
twitter-sentiment-analysis/app.py - Classification and confidence
twitter-sentiment-analysis/app.py - Sentiment labels
twitter-sentiment-analysis/app.py
User interface
- Gradio interface
twitter-sentiment-analysis/app.py - Prediction display
twitter-sentiment-analysis/app.py
Other components
- Tweet submitter
Connections 18
- Training CSV → Training workflow: reads
twitter-sentiment-analysis/trainmodel.py - Training workflow → Text cleaning: cleans text
twitter-sentiment-analysis/trainmodel.py - Text cleaning → TF-IDF fitting: fits features
twitter-sentiment-analysis/trainmodel.py - TF-IDF fitting → Train-test split: splits features
twitter-sentiment-analysis/trainmodel.py - Train-test split → Logistic regression: trains model
twitter-sentiment-analysis/trainmodel.py - Logistic regression → Model evaluation: evaluates
twitter-sentiment-analysis/trainmodel.py - Training workflow → Model artifact: saves
twitter-sentiment-analysis/trainmodel.py - Training workflow → Vectorizer artifact: saves
twitter-sentiment-analysis/trainmodel.py - Tweet submitter → Gradio interface: enters tweet
twitter-sentiment-analysis/app.py - Gradio interface → Prediction handler: invokes
twitter-sentiment-analysis/app.py - Prediction handler → Text cleaning: preprocesses
twitter-sentiment-analysis/app.py - Prediction handler → TF-IDF transform: transforms text
twitter-sentiment-analysis/app.py - TF-IDF transform → Vectorizer artifact: uses
twitter-sentiment-analysis/app.py - Prediction handler → Classification and confidence: predicts
twitter-sentiment-analysis/app.py - Classification and confidence → Model artifact: uses
twitter-sentiment-analysis/app.py - Prediction handler → Sentiment labels: maps class
twitter-sentiment-analysis/app.py - Prediction handler → Prediction display: formats result
twitter-sentiment-analysis/app.py - Gradio interface → Prediction display: displays
twitter-sentiment-analysis/app.py