private void accum_all2 ( Chunk chks [ ] , Chunk wrks , int nh [ ] , int [ ] rows ) { final DHistogram hcs [ ] [ ] = _hcs ; // Local temp arrays, no atomic updates. int bins [ ] = new int [ nbins ] ; double sums [ ] = new double [ nbins ] ; double ssqs [ ] = new double [ nbins ] ; // For All Columns for ( int c = 0 ; c < _ncols ; c ++ ) { // for all columns Chunk chk = chks [ c ] ; // For All NIDs for ( int n = 0 ; n < hcs . length ; n ++ ) { final DRealHistogram rh = ( ( DRealHistogram ) hcs [ n ] [ c ] ) ; if ( rh == null ) continue ; // Ignore untracked columns in this split final int lo = n == 0 ? 0 : nh [ n - 1 ] ; final int hi = nh [ n ] ; float min = rh . _min2 ; float max = rh . _maxIn ; // While most of the time we are limited to nbins, we allow more bins // in a few cases (top-level splits have few total bins across all // the (few) splits) so it's safe to bin more; also categoricals want // to split one bin-per-level no matter how many levels). if ( rh . _bins . length >= bins . length ) { // Grow bins if needed bins = new int [ rh . _bins . length ] ; sums = new double [ rh . _bins . length ] ; ssqs = new double [ rh . _bins . length ] ; } // Gather all the data for this set of rows, for 1 column and 1 split/NID // Gather min/max, sums and sum-squares. for ( int xrow = lo ; xrow < hi ; xrow ++ ) { int row = rows [ xrow ] ; float col_data = ( float ) chk . at0 ( row ) ; if ( col_data < min ) min = col_data ; if ( col_data > max ) max = col_data ; int b = rh . bin ( col_data ) ; // Compute bin# via linear interpolation bins [ b ] ++ ; // Bump count in bin double resp = wrks . at0 ( row ) ; sums [ b ] += resp ; ssqs [ b ] += resp * resp ; } // Add all the data into the Histogram (atomically add) rh . setMin ( min ) ; // Track actual lower/upper bound per-bin rh . setMax ( max ) ; for ( int b = 0 ; b < rh . _bins . length ; b ++ ) { // Bump counts in bins if ( bins [ b ] != 0 ) { Utils . AtomicIntArray . add ( rh . _bins , b , bins [ b ] ) ; bins [ b ] = 0 ; } if ( ssqs [ b ] != 0 ) { rh . incr1 ( b , sums [ b ] , ssqs [ b ] ) ; sums [ b ] = ssqs [ b ] = 0 ; } } } } }
For all columns for all NIDs for all ROWS ...