library(caret) Loading -6ren">
gpt4 book ai didi

r - "Something is wrong; all the Accuracy metric values are missing:"

转载 作者:行者123 更新时间:2023-11-30 09:36:47 29 4
gpt4 key购买 nike

我从 Brett Lantz 的教科书“Machine Learning With R”中取出了以下代码,但将教科书中的代码完全相同地复制到控制台,

> library(caret)
Loading required package: lattice
Loading required package: ggplot2
> library(kernlab)

Attaching package: ‘kernlab’

The following object is masked from ‘package:ggplot2’:

alpha

> set.seed(300)
> ctrl <- trainControl(method = "cv", number = 10)
> bagctrl <- bagControl(fit = svmBag$fit, predict = svmBag$pred, aggregate = svmBag$aggregate)
> setwd("~/2148OS_code/chapter 11")
> credit <- read.csv("credit.csv")
> svmbag <- train(default ~ ., data = credit, "bag", trControl = ctrl, bagControl = bagctrl)

我收到了这个回复。怎么了?

Something is wrong; all the Accuracy metric values are missing:
Accuracy Kappa
Min. : NA Min. : NA
1st Qu.: NA 1st Qu.: NA
Median : NA Median : NA
Mean :NaN Mean :NaN
3rd Qu.: NA 3rd Qu.: NA
Max. : NA Max. : NA
NA's :1 NA's :1
Error in train.default(x, y, weights = w, ...) : Stopping
In addition: There were 50 or more warnings (use warnings() to see the first 50)

警告是

> warnings()
Warning messages:
1: In data.row.names(row.names, rowsi, i) :
some row.names duplicated: 3,6,10,13,17,19,23,24,26,27,30,32,34,36,38,41,42,45,49,54,59,60,61,64,66,69,71,72,77,80,81,90,95,102,103,106,112,114,117,118,122,125,127,132,133,137,139,141,143,146,148,151,152,155,158,161,174,176,178,181,185,187,188,189,191,194,203,208,210,212,215,216,218,219,221,223,225,229,230,235,236,239,245,246,262,266,269,271,272,276,279,282,283,285,286,287,288,296,299,305,308,309,313,314,315,317,318,319,322,323,327,328,330,332,333,335,336,338,339,343,347,349,350,352,354,358,360,361,363,366,367,368,369,371,377,379,387,389,392,394,396,397,399,400,410,412,413,414,421,425,428,437,438,441,443,445,446,448,451,453,461,467,469,471,479,481,482,484,486,487,489,491,493,503,504,506,508,511,512,514,517,519,521,522,524,529,530,532,534,537,538,545,547,550,552,555,562,570,579,582,584,588,589,590,601,606,608,610,611,614,615,618,619,623,627,628,629,630,632,634,636,638,641,642,645,653,656,659,660,661,663,667,669,672,673,676,679,681,686,687,690,693,700,701,702,707,708,721,722,724,725,728, [... truncated]
2: In data.row.names(row.names, rowsi, i) :
some row.names duplicated: 3,5,8,9,13,15,18,21,25,27,29,33,36,37,41,44,45,51,52,53,55,59,60,64,66,67,72,76,77,80,91,92,96,97,102,103,104,107,110,111,113,116,119,121,122,123,127,130,133,136,139,140,143,145,147,148,149,154,158,160,164,166,168,169,171,174,176,177,178,180,182,185,187,195,199,203,205,216,218,220,223,226,231,234,236,237,238,242,245,2

最佳答案

我使用了packed为第二版提供的代码。

如果您设置并行处理,警告将会消失。您最终仍然会遇到缺少准确性指标的错误。

此错误是由于重新采样的性能度量中存在缺失值而导致的。如果重采样时结果类之一(在本例中为默认值)的样本数为零,因此敏感性或特异性未定义,则可能会发生这种情况。

我还使用插入符号包中包含的 GermanCredit 数据进行了测试,这会生成相同的错误。

关于r - "Something is wrong; all the Accuracy metric values are missing:",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38945574/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com