Created
June 16, 2018 21:17
-
-
Save MarynaLongnickel/14e6abbc3e598152fb46caf2914f367d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
train, test = train_test_split(data, test_size = 0.3) | |
cols = train.columns[:-1] | |
gnb = MultinomialNB() | |
gnb.fit(train[cols], train['sentiment']) | |
y_pred = gnb.predict(test[cols]) | |
print("Number of mislabeled points out of a total {} points : {}, performance {:05.2f}%" | |
.format( | |
test.shape[0], | |
(test["sentiment"] != y_pred).sum(), | |
100*(1-(test["sentiment"] != y_pred).sum()/test.shape[0]) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment