Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

Commit 526f62a

Browse files
committed
ml(rtees): use theRNG()
1 parent b2b253f commit 526f62a

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

modules/ml/include/opencv2/ml.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,9 +1276,6 @@ class CV_EXPORTS_W RTrees : public DTrees
12761276
/** @copybrief getTermCriteria @see getTermCriteria */
12771277
CV_WRAP virtual void setTermCriteria(const TermCriteria &val) = 0;
12781278

1279-
/** Set initial random number generator state for training the forest. */
1280-
virtual void setForestTrainRNG(const RNG& rng) = 0;
1281-
12821279
/** Returns the variable importance array.
12831280
The method returns the variable importance vector, computed at the training stage when
12841281
CalculateVarImportance is set to true. If this flag was set to false, the empty matrix is

modules/ml/src/rtrees.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ class DTreesImplForRTrees CV_FINAL : public DTreesImpl
9090
CV_TRACE_FUNCTION();
9191
DTreesImpl::clear();
9292
oobError = 0.;
93-
rng = initRng;
9493
}
9594

9695
const vector<int>& getActiveVars() CV_OVERRIDE
9796
{
9897
CV_TRACE_FUNCTION();
98+
RNG &rng = theRNG();
9999
int i, nvars = (int)allVars.size(), m = (int)activeVars.size();
100100
for( i = 0; i < nvars; i++ )
101101
{
@@ -134,6 +134,7 @@ class DTreesImplForRTrees CV_FINAL : public DTreesImpl
134134
bool train( const Ptr<TrainData>& trainData, int flags ) CV_OVERRIDE
135135
{
136136
CV_TRACE_FUNCTION();
137+
RNG &rng = theRNG();
137138
CV_Assert(!trainData.empty());
138139
startTraining(trainData, flags);
139140
int treeidx, ntrees = (rparams.termCrit.type & TermCriteria::COUNT) != 0 ?
@@ -424,8 +425,6 @@ class DTreesImplForRTrees CV_FINAL : public DTreesImpl
424425
double oobError;
425426
vector<float> varImportance;
426427
vector<int> allVars, activeVars;
427-
RNG rng;
428-
RNG initRng = RNG((uint64) - 1);
429428
};
430429

431430

0 commit comments

Comments
 (0)