make python random seed invariant in each round
This commit is contained in:
parent
76c44072d1
commit
278b788b34
@ -121,6 +121,8 @@ class Booster:
|
|||||||
assert isinstance(d,DMatrix)
|
assert isinstance(d,DMatrix)
|
||||||
dmats = ( ctypes.c_void_p * len(cache) )(*[ d.handle for d in cache])
|
dmats = ( ctypes.c_void_p * len(cache) )(*[ d.handle for d in cache])
|
||||||
self.handle = ctypes.c_void_p( xglib.XGBoosterCreate( dmats, len(cache) ) )
|
self.handle = ctypes.c_void_p( xglib.XGBoosterCreate( dmats, len(cache) ) )
|
||||||
|
# default random seed
|
||||||
|
self.set_param( {"seed": 0} )
|
||||||
self.set_param( params )
|
self.set_param( params )
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
xglib.XGBoosterFree(self.handle)
|
xglib.XGBoosterFree(self.handle)
|
||||||
|
|||||||
@ -130,6 +130,10 @@ namespace xgboost{
|
|||||||
xgboost::regrank::RegRankBoostLearner::LoadModel(fname);
|
xgboost::regrank::RegRankBoostLearner::LoadModel(fname);
|
||||||
this->init_model = true;
|
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 ){
|
const float *Pred( const DMatrix &dmat, size_t *len, int bst_group ){
|
||||||
this->CheckInit();
|
this->CheckInit();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user