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


R printcp 顯示擬合 Rpart 對象的 CP 表

R語言 printcp 位於 rpart 包(package)。

說明

顯示已安裝 rpart 對象的 cp 表。

用法

printcp(x, digits = getOption("digits") - 2)

參數

x

"rpart" 的擬合模型對象。假定這是某個函數的結果,該函數生成一個對象,該對象的命名組件與 rpart 函數返回的組件具有相同的命名組件。

digits

要打印的數字位數。

細節

根據複雜性參數打印最佳修剪表。

例子

z.auto <- rpart(Mileage ~ Weight, car.test.frame)
printcp(z.auto)
## Not run: 
Regression tree:
rpart(formula = Mileage ~ Weight, data = car.test.frame)

Variables actually used in tree construction:
[1] Weight

Root node error: 1354.6/60 = 22.576

        CP nsplit rel error  xerror     xstd 
1 0.595349      0   1.00000 1.03436 0.178526
2 0.134528      1   0.40465 0.60508 0.105217
3 0.012828      2   0.27012 0.45153 0.083330
4 0.010000      3   0.25729 0.44826 0.076998

## End(Not run)

也可以看看

summary.rpartrpart.object

相關用法


注:本文由純淨天空篩選整理自R-devel大神的英文原創作品 Displays CP table for Fitted Rpart Object。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。