当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


R butcher axe-ipred 砍倒一棵装袋的树。


*_bagg对象是从创建的伊普雷德包,用于装袋分类、回归和生存树。

用法

# S3 method for regbagg
axe_call(x, verbose = FALSE, ...)

# S3 method for classbagg
axe_call(x, verbose = FALSE, ...)

# S3 method for survbagg
axe_call(x, verbose = FALSE, ...)

# S3 method for regbagg
axe_ctrl(x, verbose = FALSE, ...)

# S3 method for classbagg
axe_ctrl(x, verbose = FALSE, ...)

# S3 method for survbagg
axe_ctrl(x, verbose = FALSE, ...)

# S3 method for regbagg
axe_data(x, verbose = FALSE, ...)

# S3 method for classbagg
axe_data(x, verbose = FALSE, ...)

# S3 method for survbagg
axe_data(x, verbose = FALSE, ...)

# S3 method for regbagg
axe_env(x, verbose = FALSE, ...)

# S3 method for classbagg
axe_env(x, verbose = FALSE, ...)

# S3 method for survbagg
axe_env(x, verbose = FALSE, ...)

参数

x

一个模型对象。

verbose

每次执行 ax 方法时打印信息。记录释放了多少内存以及禁用了哪些函数。默认为 FALSE

...

与砍伐相关的任何其他参数。

删除*_bagg 对象。

例子

library(ipred)

fit_mod <- function() {
  boop <- runif(1e6)
  bagging(y ~ x, data.frame(y = rnorm(1e4), x = rnorm(1e4)))
}

mod_fit <- fit_mod()
mod_res <- butcher(mod_fit)

weigh(mod_fit)
#> # A tibble: 705 × 2
#>    object              size
#>    <chr>              <dbl>
#>  1 mtrees.btree.terms  20.4
#>  2 mtrees.btree.terms  20.4
#>  3 mtrees.btree.terms  20.4
#>  4 mtrees.btree.terms  20.4
#>  5 mtrees.btree.terms  20.4
#>  6 mtrees.btree.terms  20.4
#>  7 mtrees.btree.terms  20.4
#>  8 mtrees.btree.terms  20.4
#>  9 mtrees.btree.terms  20.4
#> 10 mtrees.btree.terms  20.4
#> # ℹ 695 more rows
weigh(mod_res)
#> # A tibble: 480 × 2
#>    object              size
#>    <chr>              <dbl>
#>  1 mtrees.btree.where 0.680
#>  2 mtrees.btree.where 0.680
#>  3 mtrees.btree.where 0.680
#>  4 mtrees.btree.where 0.680
#>  5 mtrees.btree.where 0.680
#>  6 mtrees.btree.where 0.680
#>  7 mtrees.btree.where 0.680
#>  8 mtrees.btree.where 0.680
#>  9 mtrees.btree.where 0.680
#> 10 mtrees.btree.where 0.680
#> # ℹ 470 more rows
源代码:R/ipred.R

相关用法


注:本文由纯净天空筛选整理自Davis Vaughan等大神的英文原创作品 Axing a bagged tree.。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。