Build classification model to classifier food review sentiments using logistic regression, naive bayes through sklearn and mlflow.
|--food_review
| |--data/
| |
| |--image/
| |
| |--mlruns
| |
| |--metrics.py
| |
| |--pipeline.pkl
| |
| |--predict.py
| |
| |--sentiment_cli.py
| |
| |--train.py
|
|--README.md
|
|--requirment.txt
|
|--setup.py
The Review Sentiment is a supervised machine learning cli application that identifies if a review has postive (1) or negative (0) sentiment with probability score.
From the project directory in terminal:
- create python enviroment using conda or venv
- pip install -r requirement.txt
-
from RUBIX directory cd food_review
-
Try to use help undertand the cli
python sentiment_cli.py --helpUsage: sentiment_cli.py [OPTIONS] COMMAND [ARGS]...
Options: --help Show this message and exit.
Commands:
metrics
metricsvisualizer
predict -
To use it to predict:
-
Try with predict help:
python sentiment_cli.py predict --help
Usage: sentiment_cli.py predict [OPTIONS]
Options:
--text TEXT it can be single text review or text file with review with .txt/.csv --help Show this message and exit.
-
Try to use predict "I do not like rice anymore":
python sentiment_cli.py predict --text="I do not like rice anymore"
Verbatism: I do not like rice anymore Sentiment Value: 0 Sentiment score: 0.42%
-
-
To check the metrics of the model:
-
Check out help:
python sentiment_cli.py metrics --helpUsage: sentiment_cli.py metrics [OPTIONS]
Options: --metric [all|accuracy|auc_score|f1_score] Select which metrics you want to see --help Show this message and exit.
-
Check all the metrics:
python sentiment_cli.py metrics --metric=all
{'auc_score': 0.76, 'Accuracy': 0.76, 'f1_score': 0.75}
-
from Food-Review-Classification directory:
python setup.py develop