如何从 party::cforest() 获取 OOB 混淆矩阵?
How to get the OOB confusion matrix from `party::cforest()`?
randomForest
包中的 randomForest()
函数非常有用 provides the confusion matrix based on out-of-bag prediction in classification。
party
包 does not seem to provide this information. Searching for "confusion" in the party
documentation did not yield anything useful, nor did searching here 中的 cforest()
函数。也许我忽略了什么?
有没有办法获得 party::cforest()
分类模型的 OOB 混淆矩阵?
我从 party.pdf
比较,OOB=TRUE 和 FALSE
set.seed(290875)
### honest (i.e., out-of-bag) cross-classification of
### true vs. predicted classes
data("mammoexp", package = "TH.data")
table(mammoexp$ME, predict(cforest(ME ~ ., data = mammoexp,
control = cforest_unbiased(ntree = 50)),
OOB = TRUE))
Never Within a Year Over a Year
Never 195 31 8
Within a Year 57 46 1
Over a Year 54 20 0
table(mammoexp$ME, predict(cforest(ME ~ ., data = mammoexp,
control = cforest_unbiased(ntree = 50)),
OOB = FALSE))
Never Within a Year Over a Year
Never 212 22 0
Within a Year 58 46 0
Over a Year 54 17 3
randomForest
包中的 randomForest()
函数非常有用 provides the confusion matrix based on out-of-bag prediction in classification。
party
包 does not seem to provide this information. Searching for "confusion" in the party
documentation did not yield anything useful, nor did searching here 中的 cforest()
函数。也许我忽略了什么?
有没有办法获得 party::cforest()
分类模型的 OOB 混淆矩阵?
我从 party.pdf
比较,OOB=TRUE 和 FALSE
set.seed(290875)
### honest (i.e., out-of-bag) cross-classification of
### true vs. predicted classes
data("mammoexp", package = "TH.data")
table(mammoexp$ME, predict(cforest(ME ~ ., data = mammoexp,
control = cforest_unbiased(ntree = 50)),
OOB = TRUE))
Never Within a Year Over a Year
Never 195 31 8
Within a Year 57 46 1
Over a Year 54 20 0
table(mammoexp$ME, predict(cforest(ME ~ ., data = mammoexp,
control = cforest_unbiased(ntree = 50)),
OOB = FALSE))
Never Within a Year Over a Year
Never 212 22 0
Within a Year 58 46 0
Over a Year 54 17 3