first version that reproduce binary classification demo
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
#include <vector>
|
||||
#include "../data.h"
|
||||
#include "../utils/fmap.h"
|
||||
|
||||
namespace xgboost {
|
||||
/*! \brief namespace for gradient booster */
|
||||
@@ -63,6 +64,13 @@ class IGradBooster {
|
||||
int64_t buffer_offset,
|
||||
const std::vector<unsigned> &root_index,
|
||||
std::vector<float> *out_preds) = 0;
|
||||
/*!
|
||||
* \brief dump the model in text format
|
||||
* \param fmap feature map that may help give interpretations of feature
|
||||
* \param option extra option of the dumo model
|
||||
* \return a vector of dump for boosters
|
||||
*/
|
||||
virtual std::vector<std::string> DumpModel(const utils::FeatMap& fmap, int option) = 0;
|
||||
// destrcutor
|
||||
virtual ~IGradBooster(void){}
|
||||
};
|
||||
|
||||
@@ -141,6 +141,13 @@ class GBTree : public IGradBooster<FMatrix> {
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual std::vector<std::string> DumpModel(const utils::FeatMap& fmap, int option) {
|
||||
std::vector<std::string> dump;
|
||||
for (size_t i = 0; i < trees.size(); i++) {
|
||||
dump.push_back(trees[i]->DumpModel(fmap, option&1));
|
||||
}
|
||||
return dump;
|
||||
}
|
||||
|
||||
protected:
|
||||
// clear the model
|
||||
|
||||
Reference in New Issue
Block a user