DoNguyenAnhTuan/SentimentClassification
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
```markdown # 📝 Sentiment Classification with Machine Learning This project explores various machine learning models to classify text data based on sentiment (e.g., positive or negative). It uses standard NLP techniques for preprocessing and feature extraction. --- ## 📌 Features - ✅ Data cleaning and text preprocessing - ✅ Bag-of-Words (BoW) & TF-IDF vectorization - ✅ ML models: Naive Bayes, Logistic Regression, SVM, Decision Tree - ✅ Evaluation with accuracy, precision, recall, F1-score --- ## 📂 Structure ``` SentimentClassification/ ├── data/ │ └── reviews.csv ├── models/ │ └── naive\_bayes.py │ └── logistic\_regression.py ├── utils/ │ └── preprocess.py │ └── evaluate.py ├── main.py └── README.md ```` --- ## 🔧 Requirements Install required libraries: ```bash pip install -r requirements.txt ```` Example dependencies: * `scikit-learn` * `pandas` * `numpy` * `nltk` --- ## 🚀 How to Run ```bash python main.py ``` You can switch between models inside `main.py`. --- ## 📊 Sample Output ``` Model: Logistic Regression Accuracy: 88.7% F1-score: 0.89 ``` --- ## 🧠 Applications * Product review classification * Social media sentiment detection * Feedback analysis * Brand monitoring --- ## 👨💻 Author **Do Nguyen Anh Tuan** 🎓 MSc in Information Technology @ Lac Hong University 🏢 FabLab @ EIU | Passionate about NLP, AI & ML 🌐 [Portfolio Website](https://donguyenanhtuan.github.io/AnhTuan-Portfolio) --- B1: Tiền xử lý dữ liệu (gom, lọc, chia dữ liệu, lưu vào file mới train_sub, dev_sub, test_sub): python preprocess.py B2: Huấn luyện mô hình, bộ tham số được lưu vào folder models: python train.py Tham số: train_path: đường dẫn tới dữ liệu train test_path: đường dẫn tới dữ liệu test dev_path: đường dẫn tới dữ liệu dev save_tfidf: Nêú True thì lưu bộ tham số của tfidf save_nb: Nếu True thì lưu bộ tham số của Naive Bayes B3: Đánh giá mô hình trên tập kiểm thử (test): python evaluate.py Tham số: test_path: đường dẫn tới dữ liệu test tfidf_path: đường dẫn tới nơi lưu bộ tham số tfidf model_path: đường dẫn tới nơi lưu bộ tham số Naive Bayes save_experiments: Nếu True thì lưu kết quả dự đoán được trên tập test B4: Dự đoán cảm xúc danh sách các câu: python predict.py Tham số: tfidf_path: đường dẫn tới nơi lưu bộ tham số tfidf model_path: đường dẫn tới nơi lưu bộ tham số Naive Bayes sentences: danh sách các câu cần dự đoán B5: Tạo web, chạy demo: python demo.py