>>>>> Duncan Murdoch
>>>>> on Wed, 23 Oct 2024 05:33:57 -0400 writes:
> I've cc'd this to the package maintainer, Andy Liaw
> <[email protected]>. I'm not sure he reads this list.
> Duncan Murdoch
Also, note that you should check for absolute difference, i.e.,
if (abs(sum(cutoff) - 1) > .Machine$double.eps || ...
and I'd really recommend
if (isTRUE(all.equal(1, sum(cutoff))) || ....
Martin Maechler
> On 2024-10-23 1:26 a.m., Stevie Pederson wrote:
>> Hi,
>>
>> It appears there is an OSX-specific bug in the function
>> `randomForest.default()` Going by the source code at
>> https://github.com/cran/randomForest/blob/master/R/randomForest.default.R
>> the bug is on line 103
>>
>> If the vector `cutoff` is formed using `cutoff <-
>> rep(1/9, 9)` (line #101) the test on line 103 will fail
>> on OSX as the sum is greater than 1 due to machine
>> precision errors.
>>
>> sum(rep(1 / 9, 9)) - 1 # [1] 2.220446e-16
>>
>> This will actually occur for a scenario when the number
>> of factor levels (nclass) is 9, 11, 18, 20 etc.The
>> problem does not occur on Linux, and I haven't tested on
>> WIndows.
>>
>> A suggestion may be to change the opening test
>>
>> if (sum(cutoff) > 1 || ...)
>>
>> to
>>
>> if (sum(cutoff) - 1 > .Machine$double.eps || ...
>>
>> however, I'm sure there's a more elegant way to do this
>>
>> Thanks in advance
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [email protected] mailing list -- To UNSUBSCRIBE and
>> more, see https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> https://www.R-project.org/posting-guide.html and provide
>> commented, minimal, self-contained, reproducible code.
> ______________________________________________
> [email protected] mailing list -- To UNSUBSCRIBE and
> more, see https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> https://www.R-project.org/posting-guide.html and provide
> commented, minimal, self-contained, reproducible code.
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.