2

对这个错误有一点帮助吗?

我在 R 中运行 CFS 时得到它

运行代码:

best_features<- cfs(Target~.,df)

其中df是数据集,Targetbest_features是不言自明的。

错误:

Error in .jcall("weka/filters/Filter", "Lweka/core/Instances;", "useFilter",  :  
java.lang.IllegalArgumentException: A duplicate bin range was detected. Try increasing the bin range precision.
4

1 回答 1

0

许多函数在内部调用时A duplicate bin range was detected.会引发“ ”错误。当数据列包含太多仅相差很小的值时会发生这种情况(因为在命名 bin 时使用定点表示)。RWeka::DiscretizeFSelectorDiscretize

解决方案是将数据放大一个倍数:

numcols <- sapply(df, is.numeric)  # can be omitted if data is entirely numeric
df[numcols] <- df[numcols] * 1000  # try larger values if this is not enough

best_features <- cfs(Target~.,df)  # or anything else that uses FSelector
于 2018-10-21T17:51:32.767 回答