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 CXX = g++
export CXX = clang++
export MPICXX = mpicxx
export LDFLAGS= -pthread -lm
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("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_);

View File

@ -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