R caret 使用foreach时,插入符号中的nearZeroVar返回值会有所不同
我注意到,在nearZeroVar中设置R caret 使用foreach时,插入符号中的nearZeroVar返回值会有所不同,r-caret,R Caret,我注意到,在nearZeroVar中设置foreach=TRUE会返回一个与foreach=FALSE不同的整数向量(似乎总是1)。saveMetrics=TRUE返回的度量值没有差异。对我可能遗漏的内容有什么建议吗 frame = data.frame(seq(1:100),seq(1:100),c(rep(0,99),1)) frame = cbind(frame,frame) names(frame) = c("a","b","c","d","e","f") nearZeroVar(fr
foreach=TRUE
会返回一个与foreach=FALSE
不同的整数向量(似乎总是1)。saveMetrics=TRUE
返回的度量值没有差异。对我可能遗漏的内容有什么建议吗
frame = data.frame(seq(1:100),seq(1:100),c(rep(0,99),1))
frame = cbind(frame,frame)
names(frame) = c("a","b","c","d","e","f")
nearZeroVar(frame,allowParallel=TRUE,foreach=TRUE,saveMetrics=TRUE)
freqRatio percentUnique zeroVar nzv
a 1 100 FALSE FALSE
b 1 100 FALSE FALSE
c 99 2 FALSE TRUE
d 1 100 FALSE FALSE
e 1 100 FALSE FALSE
f 99 2 FALSE TRUE
nearZeroVar(frame,allowParallel=TRUE,foreach=FALSE,saveMetrics=TRUE)
freqRatio percentUnique zeroVar nzv
a 1 100 FALSE FALSE
b 1 100 FALSE FALSE
c 99 2 FALSE TRUE
d 1 100 FALSE FALSE
e 1 100 FALSE FALSE
f 99 2 FALSE TRUE
nearZeroVar(frame,allowParallel=TRUE,foreach=TRUE)
[1] 1 1
nearZeroVar(frame,allowParallel=TRUE,foreach=FALSE)
[1] 3 6
奇怪的解决方法:
nearZeroVar(frame,allowParallel=TRUE,foreach=TRUE,saveMetrics=TRUE)[,4]
返回T/F向量而不是列号。