'Zero Accuracy in Sentiment Analysis Model in python?
I have develop a model on sentiment analysis of two mixed languages but its accuracy score is zero. I am using this dataset. /content/drive/MyDrive/sentimant -analysis/Book_Negative.csv My code is here.
#Data Transformation
from sklearn.feature_extraction.text import CountVectorizer
cv = CountVectorizer(max_features = 900)[you can see that it give me zero accuracy][1]
#Dividing a dataset into train and test data
from sklearn.model_selection import train_test_split
X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.20)
#Model Fitting (Naive Bayes)
from sklearn.naive_bayes import GaussianNB
classifier = GaussianNB()
classifier.fit(X_train,y_train)
y_pred = classifier.predict(X_test)
from sklearn.metrics import confusion_matrix, accuracy_score
cm = confusion_matrix(y_test, y_pred)
print(cm)
accuracy_score(y_test, y_pred)
After this it gives me zero accuracy.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
