Decision tree is one of the well known and powerful supervised machine learning algorithms that can be used for classification and regression problems. The model is based on decision rules extracted from the training data. In regression problem, the model uses the value instead of class and mean squared error is used to for a decision accuracy.

Decision tree model is not good in generalization and sensitive to the changes in training data. A small change in a training dataset may effect the model predictive accuracy.

Scikit-learn
API provides the DecisionTreeRegressor class to apply decision tree method for regression task.

In this tutorial, we'll briefly learn how to fit and predict regression data by using the DecisionTreeRegressor class in Python. We'll apply the model for a randomly generated regression data and Boston housing dataset to check the performance. The tutorial
covers:

- Preparing the data
- Training the model
- Predicting and accuracy check
- Boston housing dataset prediction

- Source code listing

We'll start by loading the required libraries.