A duplicate bin range was detected. Try increasing the bin range precision

1.8k Views Asked by At

A little help wit this error ?

I get it when i am running CFS in R

Runnin code:

best_features<- cfs(Target~.,df)

where df is the dataset and Target and best_features are self explanatory.

Error:

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

There are 1 best solutions below

0
On

The "A duplicate bin range was detected." error is thrown by RWeka::Discretize which many FSelector functions call internally. It occurs when data columns contain too many values that differ only by a small amount (because Discretize uses fixed point representation when naming bins).

The solution is to scale the data by a large factor:

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