quick fix seed

This commit is contained in:
tqchen 2015-01-30 16:50:10 -08:00
parent 25957bb1d4
commit b32d4faa82
3 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,5 @@
export CC = gcc export CC = gcc
export CXX = g++ export CXX = clang++
export MPICXX = mpicxx export MPICXX = mpicxx
export LDFLAGS= -pthread -lm export LDFLAGS= -pthread -lm
export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas -fPIC export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas -fPIC

View File

@ -104,7 +104,7 @@ class BoostLearner : public rabit::ISerializable {
} }
if (!strcmp(name, "eval_metric")) evaluator_.AddEval(val); if (!strcmp(name, "eval_metric")) evaluator_.AddEval(val);
if (!strcmp("seed", name)) { 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("seed_per_iter", name)) seed_per_iteration = atoi(val);
if (!strcmp("save_base64", name)) save_base64 = 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 * \param p_train pointer to the data matrix
*/ */
inline void UpdateOneIter(int iter, const DMatrix &train) { inline void UpdateOneIter(int iter, const DMatrix &train) {
if (seed_per_iteration || rabit::IsDistributed()) { if (seed_per_iteration != 0 || rabit::IsDistributed()) {
random::Seed(this->seed * kRandSeedMagic); random::Seed(this->seed * kRandSeedMagic + iter);
} }
this->PredictRaw(train, &preds_); this->PredictRaw(train, &preds_);
obj_->GetGradient(preds_, train.info, iter, &gpair_); obj_->GetGradient(preds_, train.info, iter, &gpair_);

View File

@ -139,7 +139,7 @@ class Base64InStream: public IStream {
private: private:
FILE *fp; FILE *fp;
unsigned char tmp_ch; int tmp_ch;
int num_prev; int num_prev;
unsigned char buf_prev[2]; unsigned char buf_prev[2];
// whether we need to do strict check // whether we need to do strict check