當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


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.。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。