Skip to content

Commit

Permalink
Remove auto configuration of seed_per_iteration. (#7009)
Browse files Browse the repository at this point in the history
* Remove auto configuration of seed_per_iteration.

This should be related to model recovery from rabit, which is removed.

* Document.
  • Loading branch information
trivialfis committed Oct 17, 2021
1 parent fb1a9e6 commit fbb0dc4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion doc/parameter.rst
Expand Up @@ -420,7 +420,7 @@ Specify the learning task and the corresponding learning objective. The objectiv

* ``seed_per_iteration`` [default=false]

- Seed PRNG determnisticly via iterator number, this option will be switched on automatically on distributed mode.
- Seed PRNG determnisticly via iterator number.

***********************
Command Line Parameters
Expand Down
5 changes: 1 addition & 4 deletions include/xgboost/generic_parameters.h
Expand Up @@ -49,10 +49,7 @@ struct GenericParameter : public XGBoostParameter<GenericParameter> {
DMLC_DECLARE_ALIAS(seed, random_state);
DMLC_DECLARE_FIELD(seed_per_iteration)
.set_default(false)
.describe(
"Seed PRNG determnisticly via iterator number, "
"this option will be switched on automatically on distributed "
"mode.");
.describe("Seed PRNG determnisticly via iterator number.");
DMLC_DECLARE_FIELD(nthread).set_default(0).describe(
"Number of threads to use.");
DMLC_DECLARE_ALIAS(nthread, n_jobs);
Expand Down
6 changes: 4 additions & 2 deletions src/learner.cc
Expand Up @@ -1062,9 +1062,10 @@ class LearnerImpl : public LearnerIO {
monitor_.Start("UpdateOneIter");
TrainingObserver::Instance().Update(iter);
this->Configure();
if (generic_parameters_.seed_per_iteration || rabit::IsDistributed()) {
if (generic_parameters_.seed_per_iteration) {
common::GlobalRandom().seed(generic_parameters_.seed * kRandSeedMagic + iter);
}

this->CheckDataSplitMode();
this->ValidateDMatrix(train.get(), true);

Expand All @@ -1089,9 +1090,10 @@ class LearnerImpl : public LearnerIO {
HostDeviceVector<GradientPair>* in_gpair) override {
monitor_.Start("BoostOneIter");
this->Configure();
if (generic_parameters_.seed_per_iteration || rabit::IsDistributed()) {
if (generic_parameters_.seed_per_iteration) {
common::GlobalRandom().seed(generic_parameters_.seed * kRandSeedMagic + iter);
}

this->CheckDataSplitMode();
this->ValidateDMatrix(train.get(), true);
auto local_cache = this->GetPredictionCache();
Expand Down

0 comments on commit fbb0dc4

Please sign in to comment.