November 2018
Beginner to intermediate
182 pages
4h 48m
English
Decision trees are simple, intuitive tools for classification and regression alike. They often resemble a flow chart of decisions when seen visually, hence the name decision tree. We will reuse our pipeline, simply using the DecisionTreeClassifier as our main classification technique, as follows:
from sklearn.tree import DecisionTreeClassifier as DTCdtc_clf = Pipeline([('vect', CountVectorizer()), ('tfidf', TfidfTransformer()), ('clf',DTC())])dtc_clf.fit(X=X_train, y=y_train)dtc_acc, dtc_predictions = imdb_acc(dtc_clf)dtc_acc # 0.7028
Read now
Unlock full access