Branch: refs/heads/master
Home: https://github.com/scikit-learn/scikit-learn
Commit: 12c5ce25e885cded5d0d2beaae7589b878ed8672
https://github.com/scikit-learn/scikit-learn/commit/12c5ce25e885cded5d0d2bea...
Author: shenhanc78
Date: 2018-01-17 (Wed, 17 Jan 2018)
Changed paths:
M sklearn/tree/_splitter.pyx
Log Message:
-----------
FIX properly handle corner case. (#10450)
There is one test case that fails undefined behavior test. This happens
when n is 0, which resutls in log(n) evalutes to -inf. And to convert
-inf to integer is undefined behavior and causes exception when
undefined behavior check is turned on.
Properly handle this by early return when sorting array is zero length.
I agree this might be an usage error instead of a bug, but to leave it
vulnerable to undefined behavior exception might not a good idea.
Undefined behavior check is happy after this fix.