一分钟了解“Matlab中分类树和回归树的使用”

建立分类树:

load ionosphere % contains X and Y variables

ctree = ClassificationTree.fit(X,Y)

 

建立回归树:

load carsmall % contains Horsepower, Weight, MPG

X = [Horsepower Weight];

rtree = RegressionTree.fit(X,MPG)

 

察看一个树是什么样子的:

There are two ways to view a tree:

view(tree) %returns a text description of the tree.

view(tree,'mode','graph') %returns a graphic description of thetree.

 

使用树来进行预测工作:

Ynew = predict(ctree,mean(X))

展开阅读全文

没有更多推荐了,返回首页