Testing and validating
After loading our data, preprocessing it, creating new useful features, checking for outliers and other inconsistent data points, and choosing the right metric, we are finally ready to apply some machine learning algorithm that, by observing a series of examples and pairing them with their outcome, is able to extract a series of rules that can be successfully generalized to new examples by correctly guessing their resulting outcome. This is the supervised learning approach where a series of specialized algorithms that are fundamental to data science is used. How can we correctly apply the learning process in order to achieve the best generalizable model for prediction?
There are some best practices to be followed. Let's proceed step by step, by first loading the dataset that we will be working on in the following example:
In: from sklearn.datasets import load_digits digits = load_digits() print digits.DESCR X = digits.data y = digits.target
The digit dataset contains...