Buggy code:
public abstract class SharedTree < M extends SharedTreeModel < M , P , O > , P extends SharedTreeParameters , O extends SharedTreeOutput > extends SupervisedModelBuilder < M , P , O > { public SharedTree ( String name , P parms ) { } protected int _ntrees ; protected M _model ; protected int _ncols ; protected double _initialPrediction ; private transient float [ ] _improvPerVar ; @ Override public void init ( boolean expensive ) { } protected abstract class Driver extends H2OCountedCompleter < SharedTree < M , P , O > . Driver > { @ Override protected void compute2 ( ) { _model = null ; try { Scope . enter ( ) ; _parms . read_lock_frames ( SharedTree . this ) ; init ( true ) ; if ( ( SharedTree . Driver . error_count ( ) ) > 0 ) throw new IllegalArgumentException ( ( "Found<seq2seq4repair_space>validation<seq2seq4repair_space>errors:<seq2seq4repair_space>" + ( SharedTree . Driver . validationErrors ( ) ) ) ) ; if ( ( _parms . _checkpoint ) && ( ( DKV . get ( _destination_key ) ) != null ) ) { _model = DKV . get ( _dest ) . get ( ) ; _model . write_lock ( _key ) ; } else { <START_BUG> _model = makeModel ( _dest , _parms , initial_MSE ( SharedTree . Driver . response ( ) , SharedTree . Driver . response ( ) ) , initial_MSE ( SharedTree . Driver . response ( ) , SharedTree . Driver . vresponse ( ) ) ) ; <END_BUG> _model . delete_and_lock ( _key ) ; _model . _output . _initialPrediction = _initialPrediction ; } String [ ] domain = _response . domain ( ) ; assert ( ( ( _nclass ) > 1 ) && ( domain != null ) ) || ( ( ( _nclass ) == 1 ) && ( domain == null ) ) ; if ( ( _nclass ) == 1 ) domain = new String [ ] { "r" } ; Frame fr = _train ; if ( ( _nclass ) > 1 ) { if ( _parms . _balance_classes ) { float [ ] csf = _parms . _class_sampling_factors ; if ( ( csf != null ) && ( ( csf . length ) != ( domain . length ) ) ) throw new IllegalArgumentException ( ( ( "class_sampling_factors<seq2seq4repair_space>must<seq2seq4repair_space>have<seq2seq4repair_space>" + ( domain . length ) ) + "<seq2seq4repair_space>elements" ) ) ; Frame stratified = MRUtils . sampleFrameStratified ( fr , fr . lastVec ( ) , csf , ( ( long ) ( ( _parms . _max_after_balance_size ) * ( fr . numRows ( ) ) ) ) , _seed , true , false ) ; if ( stratified != fr ) { throw H2O . unimpl ( ) ; } } Log . info ( ( "Prior<seq2seq4repair_space>class<seq2seq4repair_space>distribution:<seq2seq4repair_space>" + ( Arrays . toString ( _model . _output . _priorClassDist ) ) ) ) ; Log . info ( ( "Model<seq2seq4repair_space>class<seq2seq4repair_space>distribution:<seq2seq4repair_space>" + ( Arrays . toString ( _model . _output . _modelClassDist ) ) ) ) ; } for ( int i = 0 ; i < ( _nclass ) ; i ++ ) fr . add ( ( "Tree_" + ( domain [ i ] ) ) , _response . makeZero ( ) ) ; for ( int i = 0 ; i < ( _nclass ) ; i ++ ) fr . add ( ( "Work_" + ( domain [ i ] ) ) , _response . makeZero ( ) ) ; for ( int i = 0 ; i < ( _nclass ) ; i ++ ) fr . add ( ( "NIDs_" + ( domain [ i ] ) ) , _response . makeCon ( ( ( _model . _output . _distribution ) == null ? 0 : ( _model . _output . _distribution [ i ] ) == 0 ? - 1 : 0 ) ) ) ; new ExcludeNAResponse ( ) . doAll ( fr ) ; _improvPerVar = new float [ _ncols ] ; buildModel ( ) ; SharedTree . Driver . done ( ) ; } catch ( Throwable t ) { Job thisJob = DKV . getGet ( _key ) ; if ( ( thisJob . _state ) == ( JobState . CANCELLED ) ) { Log . info ( "Job<seq2seq4repair_space>cancelled<seq2seq4repair_space>by<seq2seq4repair_space>user." ) ; } else { t . printStackTrace ( ) ; SharedTree . Driver . failed ( t ) ; throw t ; } } finally { if ( ( _model ) != null ) _model . unlock ( _key ) ; _parms . read_unlock_frames ( SharedTree . this ) ; if ( ( _model ) == null ) Scope . exit ( ) ; else { Key [ ] mms = _model . _output . _model_metrics ; Scope . exit ( _model . _key , ( ( mms . length ) == 0 ? null : mms [ ( ( mms . length ) - 1 ) ] ) ) ; } } SharedTree . Driver . tryComplete ( ) ; } protected abstract M makeModel ( Key modelKey , P parms , double mse_train , double mse_valid ) { } protected abstract void buildModel ( ) { } } protected DHistogram [ ] [ ] [ ] buildLayer ( final Frame fr , final int nbins , final DTree [ ] ktrees , final int [ ] leafs , final DHistogram [ ] [ ] [ ] hcs , boolean subset , boolean build_tree_one_node ) { } private static class ScoreBuildOneTree extends H2OCountedCompleter { final SharedTree _st ; final int _k ; final int _nbins ; final DTree _tree ; final int [ ] _leafs ; final DHistogram [ ] [ ] [ ] _hcs ; final Frame _fr2 ; final boolean _subset ; final boolean _build_tree_one_node ; float [ ] _improvPerVar ; boolean _did_split ;

Fix:
_model = makeModel ( _dest , _parms , initial_MSE ( SharedTree . Driver . response ( ) , SharedTree . Driver . response ( ) ) , ( ( _valid ) == null ? Double . NaN : initial_MSE ( SharedTree . Driver . response ( ) , SharedTree . Driver . vresponse ( ) ) ) ) ;