make python random seed invariant in each round
This commit is contained in:
parent
e2999a0efb
commit
6abfce620c
@ -121,6 +121,8 @@ class Booster:
|
||||
assert isinstance(d,DMatrix)
|
||||
dmats = ( ctypes.c_void_p * len(cache) )(*[ d.handle for d in cache])
|
||||
self.handle = ctypes.c_void_p( xglib.XGBoosterCreate( dmats, len(cache) ) )
|
||||
# default random seed
|
||||
self.set_param( {"seed": 0} )
|
||||
self.set_param( params )
|
||||
def __del__(self):
|
||||
xglib.XGBoosterFree(self.handle)
|
||||
|
||||
@ -130,6 +130,10 @@ namespace xgboost{
|
||||
xgboost::regrank::RegRankBoostLearner::LoadModel(fname);
|
||||
this->init_model = true;
|
||||
}
|
||||
inline void SetParam( const char *name, const char *val ){
|
||||
if( !strcmp( name, "seed" ) ) random::Seed(atoi(val));
|
||||
xgboost::regrank::RegRankBoostLearner::SetParam( name, val );
|
||||
}
|
||||
const float *Pred( const DMatrix &dmat, size_t *len, int bst_group ){
|
||||
this->CheckInit();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user