Skip to content

Instantly share code, notes, and snippets.

@makispl
Created April 11, 2020 21:28
Show Gist options
  • Save makispl/003908a448b2a14cd497fe6508f0817c to your computer and use it in GitHub Desktop.
Save makispl/003908a448b2a14cd497fe6508f0817c to your computer and use it in GitHub Desktop.
# Classify the messages of the test_set
test_set['sms_predicted'] = test_set['SMS'].apply(sms_classify_test_set)
# Calculate the accuracy of the algorithm
correct = 0
total = test_set.shape[0]
for row in test_set.iterrows():
row = row[1]
if row['Label'] == row['sms_predicted']:
correct += 1
print('Results \n-------')
print('Valid:', correct)
print('Invalid:', total - correct)
print('Accuracy:', round(correct/total, 4))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment