We will use sklearn’s built-in accuracy and confusion matrix to look at how well our naïve Bayes models are performing: # compare predictions to true labels from sklearn import metricsprint metrics.accuracy_score(y_test, preds) print metrics.confusion_matrix(y_test, preds) The output is as follows: accuracy == 0.988513998564confusion matrix ==[[12035][11174]] First off, our accuracy is great! Compared to our null […]
Classification metrics 3 – Predictions Don’t Grow on Trees, or Do They?
Note that each row represents one of the three documents (sentences), each column represents one of the words present in the documents, and each cell contains the number of times each word appears in each document. We can then use the count vectorizer to transform new incoming test documents to conform with our training set […]
Classification metrics – Predictions Don’t Grow on Trees, or Do They?
Classification metrics When evaluating classification models, different metrics are used compared to regression models. These metrics help to understand how well the model is performing, especially in terms of correctly predicting different classes. Let’s look at what they are: 2. Precision (best for binary classification – with only two classes): Also known as positive predictive […]