I've done some sentiment analysis using the the spacytextblob library, getting the polarity of the text, but I want to apply incremental learning to the model. I've been looking at creme or riverml.xyz to develop this incremental model but I realized textblob does not use a ml model for the analysis. It uses this instead https://github.com/sloria/TextBlob/blob/dev/textblob/en/en-sentiment.xml . How do I go about applying incremental learning to get an accurate depiction of sentiment?
(spacy 2.3.0)
Spacy Code: (from https://spacy.io/universe/project/spacy-textblob)
import spacy
from spacytextblob.spacytextblob import SpacyTextBlob
nlp = spacy.load('en_core_web_sm')
spacy_text_blob = SpacyTextBlob()
nlp.add_pipe(spacy_text_blob)
text = 'But every now and then I have a really good day that makes me happy.'
doc = nlp(text)
print(f'Polarity: {doc._.sentiment.polarity}')
print(f'Subjectivity: {doc._.sentiment.subjectivity}')
In terms of creme, this is a very simple application: (from https://gokhang1327.medium.com/how-to-create-a-text-classifier-online-incremental-learning-with-creme-ml-6aac9d869e5c)
import pandas as pd
from creme import compose
from creme import feature_extraction
from creme import naive_bayes
# Read dataset
df = pd.read_csv("7allV03.csv")
# Convert dataframe to list of tuples
docs = df.to_records(index=False)
# Creating the pipeline
# 1st function is creating the bag of words
# 2nd function is the naive bayes predictor
model = compose.Pipeline(
('tokenize', feature_extraction.BagOfWords(lowercase=False)),
('nb', naive_bayes.MultinomialNB(alpha=1))
)
# Training the model row by row
for sentence, label in docs:
model = model.fit_one(sentence, label)
#Make predictions
model.predict_one("text to predict category")
#Increment Model
model = model.fit_one("new text to increment model", "label for new text")
Let me know how I can approach this problem.