regression tree/classification tree, tree depth, dont understand synatx

3 次查看(过去 30 天)
Can someone explain me the following syntax (especially the one in bold), which is used in order to determine the optimal tree depth of a regression tree/classification tree: Generate minimum leaf occupancies for classification trees from 10 to 100, spaced exponentially apart:
leafs = logspace(1,2,10);
Create cross validated classification trees for the ionosphere data with minimum leaf occupancies from leafs:
rng('default') N = numel(leafs); err = zeros(N,1); for n=1:N t = ClassificationTree.fit(X,Y,'crossval','on',... 'minleaf',leafs(n)); err(n) = kfoldLoss(t); end plot(leafs,err); xlabel('Min Leaf Size'); ylabel('cross-validated error');
You can also find it under http://www.mathworks.de/de/help/stats/classification-trees-and-regression-trees.html#bsw6p3v . Also does anyone know how the default tree depth is generated? Any help on this question is very welcome, thank you!:)

采纳的回答

Alan Weiss
Alan Weiss 2014-7-1
doc logspace
y = logspace(a,b,n) generates n points between decades 10^a and 10^b.
doc rng
rng('default') puts the settings of the random number generator used by rand, randi, and randn to their default values so that they produce the same random numbers as if you restarted MATLAB. The default settings are the Mersenne Twister with seed 0.
doc kfoldLoss
Well, you get the idea. If, after reading the documentation, you still have some questions, feel free to ask again.
Alan Weiss
MATLAB mathematical toolbox documentation
  2 个评论
Tania
Tania 2014-8-1
Thanks. Do you know what the difference is between "control depth" and "pruning" in the link I posted before: http://www.mathworks.de/de/help/stats/classification-trees-and-regression-trees.html#bsw6p3v .
It basically does the same or?
Thanks!
Alan Weiss
Alan Weiss 2014-8-1
I cannot add anything to the documentation, sorry--the documented description of pruning and methods of setting the leafiness are about the depth of my knowledge.
Alan Weiss
MATLAB mathematical toolbox documentation

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Gaussian Process Regression 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by