请选择 进入手机版 | 继续访问电脑版
楼主: Nicolle
1146 10

[Resources List]Awesome Random Forest [推广有奖]

巨擘

0%

还不是VIP/贵宾

-

TA的文库  其他...

Python(Must-Read Books)

SAS Programming

Must-Read Books

威望
16
论坛币
12402323 个
通用积分
1620.7415
学术水平
3305 点
热心指数
3329 点
信用等级
3095 点
经验
477211 点
帖子
23879
精华
91
在线时间
9878 小时
注册时间
2005-4-23
最后登录
2022-3-6

Nicolle 学生认证  发表于 2017-7-20 23:33:45 |显示全部楼层 |坛友微信交流群
提示: 作者被禁止或删除 内容自动屏蔽
ReneeBK 发表于 2017-7-20 23:37:01 |显示全部楼层 |坛友微信交流群

https://cran.r-project.org/web/packages/party/party.pdf

  1. Examples
  2. set.seed(290875)
  3. ### honest (i.e., out-of-bag) cross-classification of
  4. ### true vs. predicted classes
  5. data("mammoexp", package = "TH.data")
  6. table(mammoexp$ME, predict(cforest(ME ~ ., data = mammoexp,
  7. control = cforest_unbiased(ntree = 50)),
  8. OOB = TRUE))
复制代码

使用道具

ReneeBK 发表于 2017-7-20 23:37:34 |显示全部楼层 |坛友微信交流群
  1. Examples
  2. set.seed(290875)
  3. readingSkills.cf <- cforest(score ~ ., data = readingSkills,
  4. control = cforest_unbiased(mtry = 2, ntree = 50))
  5. # standard importance
  6. varimp(readingSkills.cf)
  7. # the same modulo random variation
  8. varimp(readingSkills.cf, pre1.0_0 = TRUE)
  9. # conditional importance, may take a while...
  10. varimp(readingSkills.cf, conditional = TRUE)
复制代码

https://cran.r-project.org/web/packages/party/party.pdf

使用道具

ReneeBK 发表于 2017-7-20 23:40:58 |显示全部楼层 |坛友微信交流群
  1. Examples
  2. ## Classification:
  3. ##data(iris)
  4. set.seed(71)
  5. iris.rf <- randomForest(Species ~ ., data=iris, importance=TRUE,
  6. proximity=TRUE)

  7. print(iris.rf)
  8. ## Look at variable importance:
  9. round(importance(iris.rf), 2)
  10. ## Do MDS on 1 - proximity:
  11. iris.mds <- cmdscale(1 - iris.rf$proximity, eig=TRUE)
  12. op <- par(pty="s")
  13. pairs(cbind(iris[,1:4], iris.mds$points), cex=0.6, gap=0,
  14. col=c("red", "green", "blue")[as.numeric(iris$Species)],
  15. main="Iris Data: Predictors and MDS of Proximity Based on RandomForest")
  16. par(op)
  17. print(iris.mds$GOF)
  18. ## The `unsupervised' case:
  19. set.seed(17)
  20. iris.urf <- randomForest(iris[, -5])
  21. MDSplot(iris.urf, iris$Species)
  22. ## stratified sampling: draw 20, 30, and 20 of the species to grow each tree.
  23. (iris.rf2 <- randomForest(iris[1:4], iris$Species,
  24. sampsize=c(20, 30, 20)))
  25. ## Regression:
  26. ## data(airquality)
  27. set.seed(131)
  28. ozone.rf <- randomForest(Ozone ~ ., data=airquality, mtry=3,
  29. importance=TRUE, na.action=na.omit)
  30. print(ozone.rf)
  31. ## Show "importance" of variables: higher value mean more important:
  32. round(importance(ozone.rf), 2)
  33. ## "x" can be a matrix instead of a data frame:
  34. set.seed(17)
  35. x <- matrix(runif(5e2), 100)
  36. y <- gl(2, 50)
  37. (myrf <- randomForest(x, y))
  38. (predict(myrf, x))
  39. ## "complicated" formula:
  40. (swiss.rf <- randomForest(sqrt(Fertility) ~ . - Catholic + I(Catholic < 50),
  41. data=swiss))
  42. (predict(swiss.rf, swiss))
  43. ## Test use of 32-level factor as a predictor:
  44. set.seed(1)
  45. x <- data.frame(x1=gl(53, 10), x2=runif(530), y=rnorm(530))
  46. (rf1 <- randomForest(x[-3], x[[3]], ntree=10))
  47. ## Grow no more than 4 nodes per tree:
  48. (treesize(randomForest(Species ~ ., data=iris, maxnodes=4, ntree=30)))
  49. ## test proximity in regression
  50. iris.rrf <- randomForest(iris[-1], iris[[1]], ntree=101, proximity=TRUE, oob.prox=FALSE)
  51. str(iris.rrf$proximity)
复制代码


https://cran.r-project.org/web/packages/randomForest/randomForest.pdf

使用道具

auirzxp 学生认证  发表于 2017-7-21 00:05:03 |显示全部楼层 |坛友微信交流群
谢谢分享!!
已有 1 人评分论坛币 收起 理由
Nicolle + 20 精彩帖子

总评分: 论坛币 + 20   查看全部评分

使用道具

MouJack007 发表于 2017-7-21 00:07:40 |显示全部楼层 |坛友微信交流群
谢谢楼主分享!

使用道具

MouJack007 发表于 2017-7-21 00:07:58 |显示全部楼层 |坛友微信交流群
已有 1 人评分论坛币 收起 理由
Nicolle + 20 精彩帖子

总评分: 论坛币 + 20   查看全部评分

使用道具

h2h2 发表于 2017-7-21 06:26:28 |显示全部楼层 |坛友微信交流群
谢谢分享
已有 1 人评分论坛币 收起 理由
Nicolle + 20 精彩帖子

总评分: 论坛币 + 20   查看全部评分

使用道具

使用道具

西门高 发表于 2017-7-21 09:03:20 |显示全部楼层 |坛友微信交流群
谢谢分享

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-3-29 10:14