Udacity term one - decision tree

def classify(features_train, labels_train):
    ### import the sklearn module for GaussianNB
    from sklearn import tree
    ### create classifier
    clf = tree.DecisionTreeClassifier(min_samples_split=2)
    ### fit the classifier on the training features and labels
    clf.fit(features_train, labels_train)
    ### return the fit classifier
    return clf

Udacity term one - decision tree

accuracy=0.908

change min_samples_split=50.

def classify(features_train, labels_train):
    ### import the sklearn module for GaussianNB
    from sklearn import tree
    ### create classifier
    clf = tree.DecisionTreeClassifier(min_samples_split=50)
    ### fit the classifier on the training features and labels
    clf.fit(features_train, labels_train)
    ### return the fit classifier
    return clf
accuracy=0.912

Udacity term one - decision tree
to do list:

  1. learn more about the D.T. classifier:

class sklearn.tree.DecisionTreeClassifier(criterion=’gini’, splitter=’best’, max_depth=None, min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_features=None, random_state=None, max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, class_weight=None, presort=False)

上一篇:InfoGAN


下一篇:Maven的Scope区别笔记