sklearn.tree.DecisionTreeRegressor
Jump to navigation
Jump to search
A sklearn.tree.DecisionTreeRegressor is a regression tree learning system within sklearn.tree
.
- AKA: tree.DecisionTreeRegressor, DecisionTreeRegressor.
- Context
- Usage:
- 1) Import Regression Tree Learning System from scikit-learn :
from sklearn.tree import DecisionTreeRegressor
- 2) Create design matrix
X
and response vectorY
- 3) Create Decision Tree Regressor object:
DTreg=DecisionTreeRegressor(criterion=’mse’, splitter=’best’[, max_depth=None, min_samples_split=2, min_samples_leaf=1,...])
- 4) Choose method(s):
DTreg
.apply(X[, check_input])
, returns the leaf index for each sample predictor.DTreg
.decision_path(X[, check_input])
, returns the decision path in the tree.DTreg
.fit(X, y[, sample_weight, check_input,...])
builds a decision tree regressor from the training set (X, y).DTreg
.get_params([deep])
returns parameters for this estimator.DTreg
.predict(X[, check_input])
, predicts regression value for X.DTreg
.score(X, y[, sample_weight])
, returns the coefficient of determination R^2 of the prediction.DTreg
.set_params(**params)
, sets the parameters of this estimator.
- 1) Import Regression Tree Learning System from scikit-learn :
- Example(s):
- Counter-Example(s):
- See: Decision Tree, Regression System, Regularization Task, Ridge Regression Task, Kernel-based Classification Algorithm.
References
2017
- (Scikit-Learn, 2017) ⇒ http://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeRegressor.html Retrieved:2017-10-22
- QUOTE:
class sklearn.tree.DecisionTreeRegressor(criterion=’mse’, 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, presort=False)
Read more in the User Guide.
- QUOTE:
2015
- http://scikit-learn.org/stable/modules/tree.html#regression
- Decision trees can also be applied to regression problems, using the DecisionTreeRegressor class.
As in the classification setting, the fit method will take as argument arrays X and y, only that in this case y is expected to have floating point values instead of integer values:
- Decision trees can also be applied to regression problems, using the DecisionTreeRegressor class.