linear text dump model
This commit is contained in:
parent
d07be2bb96
commit
901904b535
@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "./gbm.h"
|
#include "./gbm.h"
|
||||||
#include "../tree/updater.h"
|
#include "../tree/updater.h"
|
||||||
@ -134,10 +135,23 @@ class GBLinear : public IGradBooster {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual std::vector<std::string> DumpModel(const utils::FeatMap& fmap, int option) {
|
|
||||||
utils::Error("gblinear does not support dump model");
|
virtual std::vector<std::string> DumpModel(const utils::FeatMap& fmap, int option) {
|
||||||
return std::vector<std::string>();
|
std::stringstream fo("");
|
||||||
}
|
fo << "bias:\n";
|
||||||
|
for (int i = 0; i < model.param.num_output_group; ++i) {
|
||||||
|
fo << model.bias()[i] << std::endl;
|
||||||
|
}
|
||||||
|
fo << "weight:\n";
|
||||||
|
for (int i = 0; i < model.param.num_output_group; ++i) {
|
||||||
|
for (int j = 0; j <model.param.num_feature; ++j) {
|
||||||
|
fo << model[i][j] << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::vector<std::string> v;
|
||||||
|
v.push_back(fo.str());
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
inline void Pred(const RowBatch::Inst &inst, float *preds) {
|
inline void Pred(const RowBatch::Inst &inst, float *preds) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user