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