In this recipe, we will perform basic classifications using Decision Trees. These are very nice models because they are easily understandable, and once trained in, scoring is very simple. Often, SQL statements can be used, which means that the outcome can be used by a lot of people.
In this recipe, we'll look at Decision Trees. I like to think of Decision Trees as the base class from which a large number of other classification methods are derived. It's a pretty simple idea that works well in a bunch of situations.
First, let's get some classification data that we can practice on:
>>> from sklearn import datasets >>> X, y = datasets.make_classification(n_samples=1000, n_features=3, n_redundant=0) ...