sklearn.tree.DecisionTreeClassifier
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
Xand response vectorY - 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.
- 1) Import Classification Tree Learning System from scikit-learn :
- Example(s):
- Counter-Example(s):
- See: Decision Tree, Classification System, Regularization Task, Ridge Regression Task, Kernel-based Classification Algorithm.
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.
- QUOTE:
2017b
- (Scikit-Learn, 2017B) ⇒ http://scikit-learn.org/stable/modules/tree.html#classification
- QUOTE: DecisionTreeClassifier is a class capable of performing multi-class classification on a dataset.
As with other classifiers, DecisionTreeClassifier takes as input two arrays: an array X, sparse or dense, of size
[n_samples, n_features]holding the training samples, and an array Y of integer values, size[n_samples], holding the class labels for the training samples:
- QUOTE: DecisionTreeClassifier is a class capable of performing multi-class classification on a dataset.