March 2019
Beginner to intermediate
464 pages
10h 57m
English
Now that we have encoded all of the categorical variables, we can finally start to build decision tree models. We are going to use the following variables as features in our decision tree models:

In order to build and train a decision tree model with Python, we are going to use the tree module in the scikit-learn (sklearn) package. You can import the required module by using the following line of code:
from sklearn import tree
Under the tree module in the sklearn package, there is a class named DecisionTreeClassifier, which we can use to train a decision tree model. Take a look at the following code:
dt_model = tree.DecisionTreeClassifier( ...
Read now
Unlock full access