[GBM] remove need to explicit InitModel, rename save/load

This commit is contained in:
tqchen
2016-01-03 05:31:00 -08:00
parent 82ceb4de0a
commit 4b4b36d047
5 changed files with 50 additions and 59 deletions

View File

@@ -32,21 +32,16 @@ class GradientBooster {
* \param cfg configurations on both training and model parameters.
*/
virtual void Configure(const std::vector<std::pair<std::string, std::string> >& cfg) = 0;
/*!
* \brief Initialize the model.
* User need to call Configure before calling InitModel.
*/
virtual void InitModel() = 0;
/*!
* \brief load model from stream
* \param fi input stream.
*/
virtual void LoadModel(dmlc::Stream* fi) = 0;
virtual void Load(dmlc::Stream* fi) = 0;
/*!
* \brief save model to stream.
* \param fo output stream
*/
virtual void SaveModel(dmlc::Stream* fo) const = 0;
virtual void Save(dmlc::Stream* fo) const = 0;
/*!
* \brief reset the predict buffer size.
* This will invalidate all the previous cached results

View File

@@ -304,7 +304,7 @@ class TreeModel {
* \brief load model from stream
* \param fi input stream
*/
inline void LoadModel(dmlc::Stream* fi) {
inline void Load(dmlc::Stream* fi) {
CHECK_EQ(fi->Read(&param, sizeof(TreeParam)), sizeof(TreeParam));
nodes.resize(param.num_nodes);
stats.resize(param.num_nodes);
@@ -327,7 +327,7 @@ class TreeModel {
* \brief save model to stream
* \param fo output stream
*/
inline void SaveModel(dmlc::Stream* fo) const {
inline void Save(dmlc::Stream* fo) const {
CHECK_EQ(param.num_nodes, static_cast<int>(nodes.size()));
CHECK_EQ(param.num_nodes, static_cast<int>(stats.size()));
fo->Write(&param, sizeof(TreeParam));