Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/0xdata/h2o
Browse files Browse the repository at this point in the history
  • Loading branch information
Anqi Fu authored and Anqi Fu committed Aug 8, 2013
2 parents cf471c0 + f771da2 commit 03703bb
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
18 changes: 18 additions & 0 deletions src/main/java/hex/gbm/DHistogram.java
Original file line number Diff line number Diff line change
Expand Up @@ -310,4 +310,22 @@ public void add( DHistogram h ) {
}
return sb.toString();
}

private int byteSize(double[]ds) { return ds==null ? 0 : 24+ds.length*8; }
private int byteSize(long []ls) { return ls==null ? 0 : 24+ls.length*8; }
private int byteSize(short []ss) { return ss==null ? 0 : 20+ss.length*2; }
public long byteSize() {
int sum = 14*8; // Rough size of empty Histogram
sum += byteSize(_bins);
sum += byteSize(_mins);
sum += byteSize(_maxs);
sum += byteSize(_Ms);
sum += byteSize(_Ss);
sum += byteSize(_MSEs);
if( _clss != null ) {
sum += (_clss.length+3)*8;
for( long[] ls : _clss ) sum += byteSize(ls);
}
return sum;
}
}
10 changes: 8 additions & 2 deletions src/main/java/hex/gbm/DRF.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private void run(Frame fr, int maxDepth, int ntrees, int mtrys, double sampleRat
Timer t_drf = new Timer();
assert 0 <= ntrees && ntrees < 1000000;
assert 0 <= mtrys && mtrys < fr.numCols();
assert 0.0 <= sampleRate && sampleRate <= 1.0;
assert 0.0 < sampleRate && sampleRate <= 1.0;

final String names[] = fr._names;
Vec vs[] = fr._vecs;
Expand Down Expand Up @@ -120,8 +120,14 @@ public int makeSomeTrees( int st, DRFTree trees[], int leafs[], int ntrees, int
for( int t=0; t<ntrees; t++ ) {
final int tmax = trees[t]._len; // Number of total splits
final DTree tree = trees[t];
for( int i=leafs[t]; i<tmax; i++ )
//int sum=0;
for( int i=leafs[t]; i<tmax; i++ ) {
tree.undecided(i)._hs = sbh.getFinalHisto(t,i);
//Histogram hs[] = tree.undecided(i)._hs;
//for( Histogram h : hs )
// if( h != null ) sum += h.byteSize();
}
//System.out.println("Tree#"+(st+t)+", leaves="+(trees[t]._len-leafs[t])+", histo size="+PrettyPrint.bytes(sum));
}

// Build up the next-generation tree splits from the current histograms.
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/water/AutoBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,12 @@ public byte[][] getAA1( ) {
for( int i=0; i<len; i++ ) ary[i] = getA1();
return ary;
}
public short[][] getAA2( ) {
int len = get4(); if( len == -1 ) return null;
short[][] ary = new short[len][];
for( int i=0; i<len; i++ ) ary[i] = getA2();
return ary;
}
public int[][] getAA4( ) {
int len = get4(); if( len == -1 ) return null;
int[][] ary = new int[len][];
Expand Down Expand Up @@ -906,6 +912,12 @@ public AutoBuffer putAA1( byte[][] ary ) {
for( int i=0; i<ary.length; i++ ) putA1(ary[i]);
return this;
}
public AutoBuffer putAA2( short[][] ary ) {
if( ary == null ) return put4(-1);
put4(ary.length);
for( int i=0; i<ary.length; i++ ) putA2(ary[i]);
return this;
}
public AutoBuffer putAA4( int[][] ary ) {
if( ary == null ) return put4(-1);
put4(ary.length);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/DRF2.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class DRF2 extends Request {
protected final FrameNonClassVecSelect vecs = new FrameNonClassVecSelect("vecs",data_key,class_vec);

@API(help="Sampling rate during tree building.")
protected final Real sample_rate = new Real("sample_rate", 0.67, 0.0, 1.0,"");
protected final Real sample_rate = new Real("sample_rate", 0.67, 0.000001, 1.0,"");

@API(help="Psuedo-random number generator seed.")
protected final LongInt seed = new LongInt("seed",0xae44a87f9edf1cbL,"High order bits make better seeds");
Expand Down

0 comments on commit 03703bb

Please sign in to comment.