DecisionTreeClassifier class works by creating a tree structure, where each node corresponds to a feature name and the branches correspond to the feature values. Tracing down the branches, you get to the leaves of the tree, which are the classification labels.
Using the same
test_feats variables we created from the
movie_reviews corpus in the previous recipe, we can call the
DecisionTreeClassifier.train() class method to get a trained classifier. We pass
binary=True because all of our features are binary: either the word is present or it's not. For other classification use cases where you have multivalued features, you will want to stick to the default
In this ...