Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

`RegressionTree.fit`

will be removed in a future
release. Use `fitrtree`

instead.

```
tree =
RegressionTree.fit(x,y)
```

tree = RegressionTree.fit(x,y,Name,Value)

returns
a regression tree based on the input variables (also known as predictors,
features, or attributes) `tree`

=
RegressionTree.fit(`x`

,`y`

)`x`

and output (response) `y`

. `tree`

is
a binary tree where each branching node is split based on the values
of a column of `x`

.

fits
a tree with additional options specified by one or more `tree`

= RegressionTree.fit(`x`

,`y`

,`Name,Value`

)`Name,Value`

pair
arguments. You can specify several name-value pair arguments in any
order as `Name1,Value1,…,NameN,ValueN`

.

Note that using the `'CrossVal'`

, `'KFold'`

, `'Holdout'`

, `'Leaveout'`

,
or `'CVPartition'`

options results in a tree of class `RegressionPartitionedModel`

.
You cannot use a partitioned tree for prediction, so this kind of
tree does not have a `predict`

method.

Otherwise, `tree`

is of class `RegressionTree`

, and
you can use the `predict`

method to make predictions.

[1] Breiman, L., J. Friedman, R. Olshen, and
C. Stone. *Classification and Regression Trees*.
Boca Raton, FL: CRC Press, 1984.

Was this topic helpful?