add smart decision of nfeatures
This commit is contained in:
@@ -49,19 +49,29 @@ namespace xgboost{
|
||||
this->train_ = train;
|
||||
this->evals_ = evals;
|
||||
this->evname_ = evname;
|
||||
//assign buffer index
|
||||
// estimate feature bound
|
||||
int num_feature = (int)(train->data.NumCol());
|
||||
// assign buffer index
|
||||
unsigned buffer_size = static_cast<unsigned>( train->Size() );
|
||||
|
||||
for( size_t i = 0; i < evals.size(); ++ i ){
|
||||
buffer_size += static_cast<unsigned>( evals[i]->Size() );
|
||||
num_feature = std::max( num_feature, (int)(evals[i]->data.NumCol()) );
|
||||
}
|
||||
char snum_pbuffer[25];
|
||||
sprintf( snum_pbuffer, "%u", buffer_size );
|
||||
|
||||
char str_temp[25];
|
||||
if( num_feature > base_model.param.num_feature ){
|
||||
sprintf( str_temp, "%d", num_feature );
|
||||
base_model.SetParam( "bst:num_feature", str_temp );
|
||||
}
|
||||
|
||||
sprintf( str_temp, "%u", buffer_size );
|
||||
base_model.SetParam( "num_pbuffer", str_temp );
|
||||
if( !silent ){
|
||||
printf( "buffer_size=%u\n", buffer_size );
|
||||
}
|
||||
base_model.SetParam( "num_pbuffer",snum_pbuffer );
|
||||
|
||||
// set eval_preds tmp sapce
|
||||
this->eval_preds_.resize( evals.size(), std::vector<float>() );
|
||||
}
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user