sklearn.tree.DecisionTreeRegressor

From GM-RKB
(Redirected from DecisionTreeRegressor class)
Jump to navigation Jump to search

A sklearn.tree.DecisionTreeRegressor is a regression tree learning system within sklearn.tree.

1) Import Regression Tree Learning System from scikit-learn : from sklearn.tree import DecisionTreeRegressor
2) Create design matrix X and response vector Y
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.


References

2017

2015