vonjd / OneR

This R package implements the One Rule (OneR) Machine Learning classification algorithm with enhancements for sophisticated handling of numeric data and missing values together with extensive diagnostic functions.
Other
40 stars 3 forks source link

Intervals #11

Closed essentialols closed 3 years ago

essentialols commented 3 years ago

When I'm using the bin function like so:

bin(c(0, 10.2111518475233, 8.35841727277084, 8.72840995681711, 
9.81168705459411, 9.29275496445946, 10.37709902364, 
10.6689924452874, 7.80259333446667, 9.26367183813303, 10.961848702671))

I get the following output:

 [1] (-0.011,2.19] (8.77,11]     (6.58,8.77]   (6.58,8.77]   (8.77,11]     (8.77,11]     (8.77,11]     (8.77,11]     (6.58,8.77]   (8.77,11]     (8.77,11]    
Levels: (-0.011,2.19] (2.19,4.38] (4.38,6.58] (6.58,8.77] (8.77,11]

I'd expect that the lower bound begins at exactly 0.

vonjd commented 3 years ago

In the default version of bin() the outer limits are moved away by 0.1% of the range to ensure that the extreme values both fall within the break intervals, so it shows the same behaviour as the base R function cut().