This project is a Twitter sentiment analysis tool that uses logistic regression to classify tweets as either positive or negative. The project is structured into three main components: function definitions, model training, and user interaction for testing the model or viewing the accuracy plot.
functions.py
: Contains all the necessary functions for tweet processing, logistic regression, and prediction.train.py
: Handles data loading, model training, and saves the trained model.test_or_plot.py
: Offers an interactive way to test new tweets or show a plot of model accuracy.
Before running this project, you need to install Python and the necessary libraries. You can install the required dependencies using:
pip install -r requirements.txt
-
- Clone the repo:
git clone https://github.com/mouraffa/Sentimental_Analysis_LogRegClassification.git
*2. Install the required packages
pip install -r requirements.txt
Run train.py
to train the model and save the parameters:
python train.py
After training the model, you can either test it with your own tweets or view the accuracy plot by running:
python test_or_plot.py
train.py
downloads tweet data, processes it, and uses it to train a logistic regression model.test_or_plot.py
allows you to input a custom tweet to get a sentiment prediction or to view a plot of the model's training accuracy.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
-
- Fork the Project
-
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
)
- Create your Feature Branch (
-
- Commit your Changes (
git commit -m 'Add some AmazingFeature'
)
- Commit your Changes (
-
- Push to the Branch (
git push origin feature/AmazingFeature
)
- Push to the Branch (
-
- Open a Pull Request