How to construct a regression tree

1 回表示 (過去 30 日間)
Salad Box
Salad Box 2019 年 1 月 8 日
編集済み: Stephen23 2019 年 1 月 9 日
Hi,
As I was trying to understand the matlab example on the documentation page for constructing a regression tree https://uk.mathworks.com/help/stats/regressiontree-class.html, below is the example.
>> load carsmall;
>> whos
Name Size Bytes Class Attributes
Acceleration 100x1 800 double
Cylinders 100x1 800 double
Displacement 100x1 800 double
Horsepower 100x1 800 double
MPG 100x1 800 double
Mfg 100x13 2600 char
Model 100x33 6600 char
Model_Year 100x1 800 double
Origin 100x7 1400 char
Weight 100x1 800 double
>> tree = fitrtree([Weight, Cylinders],MPG,...
'categoricalpredictors',2,'MinParentSize',20,...
'PredictorNames',{'W','C'})
tree =
RegressionTree
PredictorNames: {'W' 'C'}
ResponseName: 'Y'
CategoricalPredictors: 2
ResponseTransform: 'none'
NumObservations: 94
Properties, Methods
>> mileage4K = predict(tree,[4000 4; 4000 6; 4000 8])
mileage4K =
19.2778
19.2778
14.3889
I wonder how the mileage is predicted while there is no variable in 'carsmall' named mileage.
  3 件のコメント
Salad Box
Salad Box 2019 年 1 月 9 日
編集済み: Salad Box 2019 年 1 月 9 日
Yes you are right. Someone who constructed 'fitrtree' documentation webpage has comfirmed that the varialbe 'MPG' is the variable 'mileage'. But as someone living in the UK, mileage means the total miles a car has been driven.
Thanks for answering!
Star Strider
Star Strider 2019 年 1 月 9 日
My pleasure!
As Winston Churchill noted, the U.S. and the U.K. are ‘two nations divided by a common language’.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGaussian Process Regression についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by