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

3 visualizaciones (últimos 30 días)
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!:)

Respuesta aceptada

Alan Weiss
Alan Weiss el 1 de Jul. de 2014
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 comentarios
Tania
Tania el 1 de Ag. de 2014
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 el 1 de Ag. de 2014
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

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by