Somewhere around 40 to 43% of the time when I am showing new learners how to use the
.predict() methods I get the following question:
Where are the predictions?
I wish this was a question learners would ask more often. It is an insightful question, especially for folks who are newer to Python, data science, and who may be seeing the
.predict() method for the first time.
For sure the number of groups who ask this question is less than half, but possibly, the proportion is lower than 30 or 20%. I don’t keep precise track.
In part one of this deep dive, this article will first show how to build a simple predictive model, second how to generate predictions, and third cover how to inspect predictions more closely.
For part two of this deep dive this article will also show why it is useful to know how to inspect individual predictions plus also why it is necessary to inspect individual predictions. Having the ability to inspect individual predictions opens a range of analytical avenues, for example not the least of which is the negative case analysis.
If you are not yet familiar with building predictive model I suggest you consider reading one or more other articles that cover this topic. Chapter 11 of Confident Data Science: Discovering The Essential Skills of Data Science (by, Me) shows how to build predictive models.
For example, in Fake Birds & Machine Learning: Using the popular bird variety data to demonstrate nearest neighbors classification I shared code that trained a machine learning model that can predict bird species variety based on a bird’s weight, length, location, and color. This fake birds example demonstrated predictive modeling with the fake bird species data.
A Simple Predictive Model
To help us focus on inspecting specific individual predictions this subsection will speed through the creation of a predictive model. To be speedy this subsection skips optimizing hyper parameters and also skips a few data preparation steps.
Also to speed things along we look at evaluation through alternate methods aside…