fix
This commit is contained in:
parent
2057dda560
commit
21f93ffd6a
@ -96,6 +96,8 @@ class Booster:
|
||||
dmats = ( ctypes.c_void_p * len(cache) )(*[ ctypes.c_void_p(d.handle) for d in cache])
|
||||
self.handle = xglib.XGBoosterCreate( dmats, len(cache) )
|
||||
self.set_param( params )
|
||||
def __del__(self):
|
||||
xglib.XGBoosterFree(self.handle)
|
||||
def set_param(self, params,pv=None):
|
||||
if isinstance(params,dict):
|
||||
for k, v in params.iteritems():
|
||||
|
||||
@ -170,6 +170,9 @@ extern "C"{
|
||||
}
|
||||
return new Booster( mats );
|
||||
}
|
||||
void XGBoosterFree( void *handle ){
|
||||
delete static_cast<Booster*>(handle);
|
||||
}
|
||||
void XGBoosterSetParam( void *handle, const char *name, const char *value ){
|
||||
static_cast<Booster*>(handle)->SetParam( name, value );
|
||||
}
|
||||
|
||||
@ -109,6 +109,11 @@ extern "C"{
|
||||
* \param create a booster
|
||||
*/
|
||||
void *XGBoosterCreate( void* dmats[], size_t len );
|
||||
/*!
|
||||
* \brief free obj in handle
|
||||
* \param handle handle to be freed
|
||||
*/
|
||||
void XGBoosterFree( void* handle );
|
||||
/*!
|
||||
* \brief set parameters
|
||||
* \param handle handle
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user