From b32d4faa82ee7546614d3f728957d92b620c73f1 Mon Sep 17 00:00:00 2001 From: tqchen Date: Fri, 30 Jan 2015 16:50:10 -0800 Subject: [PATCH] quick fix seed --- Makefile | 2 +- src/learner/learner-inl.hpp | 6 +++--- src/utils/base64.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a4bbe876f..abdeb0bb8 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ export CC = gcc -export CXX = g++ +export CXX = clang++ export MPICXX = mpicxx export LDFLAGS= -pthread -lm export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas -fPIC diff --git a/src/learner/learner-inl.hpp b/src/learner/learner-inl.hpp index 616cf03e9..f7af5bfff 100644 --- a/src/learner/learner-inl.hpp +++ b/src/learner/learner-inl.hpp @@ -104,7 +104,7 @@ class BoostLearner : public rabit::ISerializable { } if (!strcmp(name, "eval_metric")) evaluator_.AddEval(val); if (!strcmp("seed", name)) { - this->seed = seed; random::Seed(atoi(val)); + seed = atoi(val); random::Seed(seed); } if (!strcmp("seed_per_iter", name)) seed_per_iteration = atoi(val); if (!strcmp("save_base64", name)) save_base64 = atoi(val); @@ -269,8 +269,8 @@ class BoostLearner : public rabit::ISerializable { * \param p_train pointer to the data matrix */ inline void UpdateOneIter(int iter, const DMatrix &train) { - if (seed_per_iteration || rabit::IsDistributed()) { - random::Seed(this->seed * kRandSeedMagic); + if (seed_per_iteration != 0 || rabit::IsDistributed()) { + random::Seed(this->seed * kRandSeedMagic + iter); } this->PredictRaw(train, &preds_); obj_->GetGradient(preds_, train.info, iter, &gpair_); diff --git a/src/utils/base64.h b/src/utils/base64.h index 36699199f..66e090ab0 100644 --- a/src/utils/base64.h +++ b/src/utils/base64.h @@ -139,7 +139,7 @@ class Base64InStream: public IStream { private: FILE *fp; - unsigned char tmp_ch; + int tmp_ch; int num_prev; unsigned char buf_prev[2]; // whether we need to do strict check