Skip to content

Commit

Permalink
ibrahimsharaf#14 added classifier method test_model
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayatallah committed May 14, 2019
1 parent 67d6ee9 commit d9dcbfa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion models/classifier_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,12 @@ def load_model(self,filename):
loaded_model = joblib.load(filename)
self.model = loaded_model
else:
self.model = None
self.model = None

def test_model(self,d2v, testing_vectors, testing_labels):
logging.info("Classifier testing")
test_vectors = doc2VecBuilder.get_vectors(d2v, len(testing_vectors), 300, 'Test')
testing_predictions = self.model.predict(test_vectors)
logging.info('Testing predicted classes: {}'.format(np.unique(testing_predictions)))
logging.info('Testing accuracy: {}'.format(accuracy_score(testing_labels, testing_predictions)))
logging.info('Testing F1 score: {}'.format(f1_score(testing_labels, testing_predictions, average='weighted')))

0 comments on commit d9dcbfa

Please sign in to comment.