From 7a79c009ce3c94a86500ed12d96a2595840249d7 Mon Sep 17 00:00:00 2001 From: tqchen Date: Tue, 29 Apr 2014 09:59:10 -0700 Subject: [PATCH] chg fmap format --- regression/xgboost_reg.h | 1 + regression/xgboost_reg_main.cpp | 2 +- utils/xgboost_fmap.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/regression/xgboost_reg.h b/regression/xgboost_reg.h index cf0967076..d676de3e2 100644 --- a/regression/xgboost_reg.h +++ b/regression/xgboost_reg.h @@ -166,6 +166,7 @@ namespace xgboost{ buffer_offset += static_cast(evals_[i]->Size()); } fprintf(fo, "\n"); + fflush(fo); } /*! \brief get prediction, without buffering */ inline void Predict(std::vector &preds, const DMatrix &data){ diff --git a/regression/xgboost_reg_main.cpp b/regression/xgboost_reg_main.cpp index f3ff4003f..c780caf36 100644 --- a/regression/xgboost_reg_main.cpp +++ b/regression/xgboost_reg_main.cpp @@ -156,7 +156,7 @@ namespace xgboost{ elapsed = (unsigned long)(time(NULL) - start); } // always save final round - if (save_period == 0 || num_round % save_period != 0){ + if ((save_period == 0 || num_round % save_period != 0) && model_out != "NONE"){ if (model_out == "NULL"){ this->SaveModel(num_round - 1); } diff --git a/utils/xgboost_fmap.h b/utils/xgboost_fmap.h index cbb974d9b..fcd9d7756 100644 --- a/utils/xgboost_fmap.h +++ b/utils/xgboost_fmap.h @@ -32,7 +32,7 @@ namespace xgboost{ inline void LoadText(FILE *fi){ int fid; char fname[256], ftype[256]; - while (fscanf(fi, "%d%s%s", &fid, fname, ftype) == 3){ + while (fscanf(fi, "%d\t%[^\t]\t%s\n", &fid, fname, ftype) == 3){ utils::Assert(fid == (int)names_.size(), "invalid fmap format"); names_.push_back(std::string(fname)); types_.push_back(GetType(ftype));