mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
Add logistic regression sentiment analysis
This commit is contained in:
parent
fc404ef0d4
commit
dd9bfa8d33
24
README.md
24
README.md
|
@ -227,32 +227,30 @@ nlp = en_core_web_sm.load()
|
||||||
doc = nlp("This is a sentence.")
|
doc = nlp("This is a sentence.")
|
||||||
```
|
```
|
||||||
|
|
||||||
📖 **For more info and examples, check out the
|
## 📊 Custom Sentiment Analysis with Logistic Regression (spaCy-based)
|
||||||
[models documentation](https://spacy.io/docs/usage/models).**
|
This repository also includes a custom **Logistic Regression** sentiment analysis model built using spaCy, without using scikit-learn. The model classifies text as positive or negative based on a dataset such as IMDb reviews.
|
||||||
|
|
||||||
## 📊 Custom Sentiment Analysis with Logistic Regression
|
|
||||||
|
|
||||||
This implementation includes a custom **Logistic Regression** sentiment analysis model built using spaCy, without using scikit-learn. The model classifies text as positive or negative based on datasets like IMDb reviews.
|
|
||||||
|
|
||||||
### Running the Model
|
### Running the Model
|
||||||
To run the logistic regression model:
|
To run the logistic regression model:
|
||||||
```bash
|
```bash
|
||||||
python pure_Logistic.py
|
python pure_Logistic.py
|
||||||
```
|
```This script processes the dataset using spaCy, trains the logistic regression model, and outputs the results.
|
||||||
|
|
||||||
### Testing and Evaluation
|
### Testing and Evaluation
|
||||||
To run tests and evaluate the model's performance:
|
To run tests and evaluate the model's performance, use:
|
||||||
```bash
|
```bash
|
||||||
python test_pure_logistic.py
|
python test_pure_logistic.py
|
||||||
```
|
```
|
||||||
|
|
||||||
To use the model in your own code:
|
In your test script, import the PureLogisticTextCategorizer class for evaluation:
|
||||||
```python
|
```bash
|
||||||
from pure_Logistic import PureLogisticTextCategorizer
|
from pure_Logistic import PureLogisticTextCategorizer
|
||||||
|
|
||||||
# Initialize and use the classifier
|
|
||||||
categorizer = PureLogisticTextCategorizer()
|
|
||||||
```
|
```
|
||||||
|
This enables you to evaluate the logistic regression classifier on your test cases.
|
||||||
|
|
||||||
|
|
||||||
|
📖 **For more info and examples, check out the
|
||||||
|
[models documentation](https://spacy.io/docs/usage/models).**
|
||||||
|
|
||||||
## ⚒ Compile from source
|
## ⚒ Compile from source
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user