[PYTHON-DIST] Distributed xgboost python training API.

This commit is contained in:
tqchen
2016-02-29 10:00:37 -08:00
parent 51bb556898
commit ecb3a271be
16 changed files with 427 additions and 32 deletions

View File

@@ -358,6 +358,30 @@ XGB_DLL int XGBoosterDumpModelWithFeatures(BoosterHandle handle,
bst_ulong *out_len,
const char ***out_models);
/*!
* \brief Get string attribute from Booster.
* \param handle handle
* \param key The key of the attribute.
* \param out The result attribute, can be NULL if the attribute do not exist.
* \param success Whether the result is contained in out.
* \return 0 when success, -1 when failure happens
*/
XGB_DLL int XGBoosterGetAttr(BoosterHandle handle,
const char* key,
const char** out,
int *success);
/*!
* \brief Set string attribute.
*
* \param handle handle
* \param key The key of the symbol.
* \param value The value to be saved.
* \return 0 when success, -1 when failure happens
*/
XGB_DLL int XGBoosterSetAttr(BoosterHandle handle,
const char* key,
const char* value);
// --- Distributed training API----
// NOTE: functions in rabit/c_api.h will be also available in libxgboost.so
/*!
@@ -376,6 +400,6 @@ XGB_DLL int XGBoosterLoadRabitCheckpoint(
* \param handle handle
* \return 0 when success, -1 when failure happens
*/
XGB_DLL int XGBoosterSaveRabitCheckPoint(BoosterHandle handle);
XGB_DLL int XGBoosterSaveRabitCheckpoint(BoosterHandle handle);
#endif // XGBOOST_C_API_H_

View File

@@ -109,6 +109,21 @@ class Learner : public rabit::Serializable {
std::vector<float> *out_preds,
unsigned ntree_limit = 0,
bool pred_leaf = false) const = 0;
/*!
* \brief Set additional attribute to the Booster.
* The property will be saved along the booster.
* \param key The key of the property.
* \param value The value of the property.
*/
virtual void SetAttr(const std::string& key, const std::string& value) = 0;
/*!
* \brief Get attribute from the booster.
* The property will be saved along the booster.
* \param key The key of the attribute.
* \param out The output value.
* \return Whether the key is contained in the attribute.
*/
virtual bool GetAttr(const std::string& key, std::string* out) const = 0;
/*!
* \return whether the model allow lazy checkpoint in rabit.
*/