Chinaunix首页 | 论坛 | 博客
  • 博客访问: 628954
  • 博文数量: 149
  • 博客积分: 3901
  • 博客等级: 中校
  • 技术积分: 1558
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-16 14:33
文章分类

全部博文(149)

文章存档

2014年(2)

2013年(10)

2012年(32)

2011年(21)

2010年(84)

分类:

2010-05-05 11:08:36

Fit a Classification or Regression Tree 

拟合分类和回归tree

>install.packages(tree)
>help(tree)
主方法 :
tree(formula = formula(data), data = parent.frame(),
weights, subset,
na.action = na.pass, control = tree.control(nobs, ...),
method = "recursive.partition",
split = c("deviance", "gini"),
model = NULL, x = FALSE, y = TRUE, wts = TRUE, ...)
> data(cpus, package="MASS")
1> cpus.ltr <- tree(log10(perf) ~ syct + mmin + mmax + cach + chmin + chmax, data=cpus)
# 1 与 2 相同
2> attach(cpus)
2> cpus.ltr <- tree(log10(perf) ~ syct + mmin + mmax + cach + chmin + chmax)
#这能说明 参数中 formula = formula(data), data = parent.frame()

library(MASS)
data(cpus)
cpus.ltr <- tree(log10(perf) ~ syct+mmin+mmax+cach+chmin+chmax, cpus)
cpus.ltr
summary(cpus.ltr)
plot(cpus.ltr); text(cpus.ltr)

data(iris)
ir.tr <- tree(Species ~., iris)
ir.tr
summary(ir.tr)




阅读(1056) | 评论(0) | 转发(0) |
0

上一篇:mysql 导入导出 命令

下一篇:py mongodb

给主人留下些什么吧!~~