필터 지우기
필터 지우기

How to get the out degree of trees?

조회 수: 2 (최근 30일)
jy tan
jy tan 2012년 2월 26일
tree = [0 1 2 2 2 2 2 1 8 8 1 11 11 1 14];
C=children(tree);
treeplot(tree);
count = size(tree,2);
[x,y] = treelayout(tree);
x = x';
y = y';
name1 = cellstr(num2str((1:count)'));
text(x(:,1), y(:,1), name1, 'VerticalAlignment','bottom','HorizontalAlignment','right');
title({'Level Lines'},'FontSize',12,'FontName','Times New Roman');
why the one in bold doesn't work?

답변 (1개)

Walter Roberson
Walter Roberson 2012년 2월 26일
Your "tree" variable is not a classregtree as is required for the children() function. See http://www.mathworks.com/help/toolbox/stats/classregtree.children.html
  댓글 수: 3
Walter Roberson
Walter Roberson 2012년 2월 26일
Once the tree is a classregtree, then
C = children(TheClassRegTree);
outdegree = sum(C~=0,2);
and outdegree for node #3 would be outdegree(3) with the children of node #3 being C(3,:)
In order to create a classregtree you need both a predictor and a response. You appear to be missing one of those two.
http://www.mathworks.com/help/toolbox/stats/classregtree.html
jy tan
jy tan 2012년 3월 6일
i still dont get it, how do u initialise a classregtree
what is the meaning of X and y
t = classregtree(X,y)
t = classregtree(X,y,'Name',value)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Smoothing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by