检测到重复的bin范围。尝试增加bin范围精度

时间:2018-02-10 18:36:24

标签: r weka cfs fselector

这个错误有点帮助吗?

我在R

中运行CFS时得到它

Runnin代码:

best_features<- cfs(Target~.,df)

其中 df 是数据集 目标 best_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.

1 个答案:

答案 0 :(得分:0)

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

解决方案是将数据按比例缩放:

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