Skip to content

Commit

Permalink
PUBDEV-1671: Fix variance computation for DRealHistogram when there's…
Browse files Browse the repository at this point in the history
… only 1 count (N=1), was dividing by 0 during 1/N * 1/(N-1)
  • Loading branch information
arnocandel committed Jul 27, 2015
1 parent 6ceac99 commit cf886a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion h2o-algos/src/main/java/hex/tree/DRealHistogram.java
Expand Up @@ -25,7 +25,7 @@ public DRealHistogram(String name, final int nbins, int nbins_cats, byte isInt,
}
@Override public double var (int b) {
double n = _bins[b];
if( n==0 ) return 0;
if( n<=1 ) return 0;
return (_ssqs[b] - _sums[b]*_sums[b]/n)/(n-1);
}

Expand Down

0 comments on commit cf886a7

Please sign in to comment.