Crossval and regressiontree.fit - how does crossval works?

Hey!:) I am using Regressiontree.fit in order to do build a decision tree for my data. If I want it to do cross validation automatic I have to include (‘crossval’,’on’), right? I have done it, but I am not quite sure what matlab has done exactly? What does KFold 10 means? How does this automatic crossvalidation works?
Thanks a lot for your help!
Please find my code below: >> rtree=RegressionTree.fit(X,price,'crossval', 'on' )
rtree =
classreg.learning.partition.RegressionPartitionedModel
CrossValidatedModel: 'Tree'
PredictorNames: {'x1' 'x2' 'x3'}
CategoricalPredictors: []
ResponseName: 'Y'
NObservations: 5255
KFold: 10
Partition: [1x1 cvpartition]
ResponseTransform: 'none'

 採用された回答

Shashank Prasanna
Shashank Prasanna 2014 年 6 月 30 日
編集済み: Shashank Prasanna 2014 年 6 月 30 日

0 投票

What does KFold 10 means?
matlab has done exactly?
MATLAB has performed kfold cross-validation and returned a partitioned model instead of a single regression tree. Crossvalidation allows you to assess the predictive performance of model on cross-validated data. You can access these methods using the output of a cross validated model: kfoldfun, kfoldLoss, kfoldPredict.
Alternatively you can fit a model and then call cross val this way:
rtree = RegressionTree.fit(X,price);
rcrossvaltree = crossval(rtree);
Read more here (also includes examples):

5 件のコメント

Tania
Tania 2014 年 7 月 1 日
Hi! Great, thank you for your help. Another question maybe you also know the answer to it. Before I only used numerical values in my regression tree, but now I need to use postcode. I think I can not use the function dummyvar (to create dummy variables) here. Do you have an idea how to handle this non-numerical data in a regression tree? Thanks a lot!:)
Shashank Prasanna
Shashank Prasanna 2014 年 7 月 1 日
you can certainly use dummyvar yourself before you call RegressionTree.fit (or fitrtree as of 14a). But even better if let the function handle that for you so you don't have to worry about it.
Click on the link below and read how to specify a categorical predictor:
Tania
Tania 2014 年 7 月 2 日
Thanks a lot. Sry, just one additional question, you seem to have a lot of knowledge. Do you have any idea why MSE is called resubLoss in regression trees?and how can I find out other accuracy measurements for regression trees like MAE,etc.?
Shashank Prasanna
Shashank Prasanna 2014 年 7 月 2 日
Both you questions are answered in the documentation page:
Tania
Tania 2014 年 7 月 9 日
thank you!

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

その他の回答 (0 件)

質問済み:

2014 年 6 月 30 日

コメント済み:

2014 年 7 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by