Sentiment Analysis in Python
Violeta Misheva
Data Scientist
$$ Probability(sentiment=positive|review) $$
from sklearn.linear_model import LogisticRegression
log_reg = LogisticRegression().fit(X, y)
Accuracy: Fraction of predictions our model got right.
# Accuracy using score
score = log_reg.score(X, y)
print(score)
0.9009
# Accuracy using accuracy_score
from sklearn.metrics import accuracy_score
y_predicted = log_reg.predict(X)
acurracy = accuracy_score(y, y_predicted)
0.9009
Sentiment Analysis in Python