Measuring model performance
1. Measuring model performance Now we can make predictions using a classifier, but how do we know if the model is making correct predictions? We can evaluate its performance! 2. Measuring model performance In classification, accuracy is a commonly-used metric. Accuracy is the number of correct predictions divided by the total number of observations. 3. Measuring model performance How do we measure accuracy? We could compute accuracy on the data used to fit the classifier. However, as this data was used to train the model, performance will not be indicative of how well it can generalize to unseen data, which is what we are interested in! 4. Computing accuracy It is common to split data into a training set and a test set. 5. Computing accuracy We fit the classifier using the training set, 6. Computing accuracy then we calculate the model's accuracy against the test set's labels. 7. Train/test split To do this, we import train_test_split from sklearn-dot-model_selection. We call...