arshvir commited on
Commit
b97a69a
·
verified ·
1 Parent(s): 2321e1e

Update README.md

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