R,DMwR软件包,SMOTE功能不起作用 [英] R, DMwR-package, SMOTE-function won't work
本文介绍了R,DMwR软件包,SMOTE功能不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将smote-algorithm应用于数据集,但无法使其正常工作。
I need to apply the smote-algorithm to a data set, but can't get it to work.
示例:
x <- c(12,13,14,16,20,25,30,50,75,71)
y <- c(0,0,1,1,1,1,1,1,1,1)
frame <- data.frame(x,y)
library(DMwR)
smotedobs <- SMOTE(y~ ., frame, perc.over=300)
这会产生以下错误:
Error in scale.default(T, T[i, ], ranges) : subscript out of bounds
In addition: Warning messages:
1: In FUN(newX[, i], ...) :
no non-missing arguments to max; returning -Inf
2: In FUN(newX[, i], ...) : no non-missing arguments to min; returning Inf
将使用任何形式的帮助或提示。
Would appriciate any kind of help or hints.
推荐答案
我没有完整的答案。不过,我可以提供另一个线索:
I don't have the full answer. I can provide another clue though:
如果将y转换为因子,SMOTE将返回而没有错误-但合成的观测值具有x的NA值。
If you convert 'y' to a factor, SMOTE will return without error - but the synthesized observations have NA values for x.
这篇关于R,DMwR软件包,SMOTE功能不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文