sthoooon
2/9/2017 - 10:29 PM

Decision Trees non-parametric supervised learning method used for classification and regression. The goal is to create a model that predicts

Decision Trees non-parametric supervised learning method used for classification and regression. The goal is to create a model that predicts the value of a target variable by learning simple decision rules inferred from the data features.

from sklearn import tree

clf = tree.DecisionTreeClassifier()
clf = clf.fit(features_train, label_train)

#predict the class of samples
clf.predict(features_test)

#predict probability of each class, 
#which is the fraction of training samples of the same class in a leaf:
clf.predict_proba(features_test)