jaihodigital commited on
Commit
0aaf28c
·
verified ·
1 Parent(s): 9cd7c55

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +86 -3
README.md CHANGED
@@ -1,3 +1,86 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ metrics:
6
+ - accuracy
7
+ - precision
8
+ - recall
9
+ - f1
10
+ pipeline_tag: text-classification
11
+ tags:
12
+ - NLP
13
+ - SentimentAnalysis
14
+ - LogisticRegression
15
+ - ScikitLearn
16
+ ---
17
+ # 🧠 Sentiment Analysis with Logistic Regression
18
+
19
+ This model performs **multi-class sentiment analysis** on tweets, classifying them into the following categories:
20
+ - Positive
21
+ - Negative
22
+ - Neutral
23
+ - Irrelevant
24
+
25
+ It uses a custom preprocessing pipeline with:
26
+ <!-- - Text cleaning (URL, mention, hashtag, punctuation removal)-->
27
+ - CountVectorizer
28
+ - TF-IDF transformation
29
+ - Logistic Regression classifier (`max_iter=1000`)
30
+
31
+ ---
32
+
33
+ ## 🏗 Model Architecture
34
+
35
+ <!-- - **TextCleaner**: Custom scikit-learn transformer for consistent text preprocessing.-->
36
+ - **CountVectorizer**: Converts tweets into token count vectors.
37
+ - **TfidfTransformer**: Reweights tokens by importance.
38
+ - **LogisticRegression**: Interpretable and robust classification baseline.
39
+
40
+ ---
41
+
42
+ ## 🧪 Evaluation
43
+
44
+ Evaluated on a separate validation set of 999 tweets:
45
+
46
+ | Class | Precision | Recall | F1-score |
47
+ |-------------|-----------|--------|----------|
48
+ | Irrelevant | 0.88 | 0.85 | 0.87 |
49
+ | Negative | 0.87 | 0.94 | 0.91 |
50
+ | Neutral | 0.97 | 0.86 | 0.91 |
51
+ | Positive | 0.89 | 0.94 | 0.91 |
52
+ | **Overall Accuracy** | | | **0.90** |
53
+
54
+ ---
55
+
56
+ ## 📦 Usage
57
+
58
+ ```
59
+ python
60
+ import joblib
61
+
62
+ model = joblib.load("sentiment_model_lr.pkl")
63
+ user_input = "This update is surprisingly good!"
64
+
65
+ prediction = model.predict([user_input])
66
+ print(prediction[0]) # → Positive, Negative, etc.
67
+ ```
68
+ ---
69
+ ```> ⚠️ Requires scikit-learn 1.6.1+ to avoid version mismatch warnings.```
70
+
71
+ ---
72
+
73
+ ## 📚 Dataset
74
+ ```
75
+ Tweets were preprocessed using a clean_text routine and labeled into
76
+ the four sentiment categories. If you’d like to experiment or re-train, contact
77
+ the author or fork this repo.
78
+ ```
79
+
80
+ ---
81
+ ## 🧑‍💻 Author
82
+ ```
83
+ Built by @arshvir Model version: 1.0 License: MIT
84
+ ```
85
+
86
+ ---