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

来源:互联网 发布:js 寄生组合式继承 编辑:程序博客网 时间:2024/05/22 17:46

建立分类树:

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))

阅读全文
0 0
原创粉丝点击