sklearn.tree.DecisionTreeClassifier

From GM-RKB
Jump to navigation Jump to search

A sklearn.tree.DecisionTreeClassifier is a classification tree learning system within sklearn.tree.

  • Context
    • Usage:
1) Import Classification Tree Learning System from scikit-learn : from sklearn.tree import DecisionTreeClassifier
2) Create design matrix X and response vector Y
3) Create Decision Tree Classifier object: DTclf=DecisionTreeClassifier(criterion=’gini’, splitter=’best’[, max_depth=None, min_samples_split=2, min_samples_leaf=1,...])
4) Choose method(s):
  • DTclf.apply(X[, check_input]), returns the leaf index for each sample predictor.
  • DTclf.decision_path(X[, check_input]), returns the decision path in the tree.
  • DTclf.fit(X, y[, sample_weight, check_input,...]) builds a decision tree classifier from the training set (X, y).
  • DTclf.get_params([deep]) returns parameters for this estimator.
  • DTclf.predict(X[, check_input]), predicts class for X.
  • DTclf.predict_log_proba(X), predicts class log-probabilities of the input samples X.
  • DTclf.predict_proba(X[, check_input]), predicts class probabilities of the input samples X.
  • DTclf.score(X, y[, sample_weight]), returns the mean accuracy on the given test data and labels.
  • DTclf.set_params(**params), sets the parameters of this estimator.


References

2017a

  • (Scikit-Learn, 2017A) ⇒ http://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html Retrieved:2017-10-22
    • QUOTE: 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)

      A decision tree classifier.

      Read more in the User Guide.

2017b