1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

This commit is contained in:
Alexander Alekhin
2020-09-05 18:53:51 +00:00
9 changed files with 133 additions and 42 deletions
+9 -2
View File
@@ -216,13 +216,14 @@ public:
sample = Mat( nallvars, 1, CV_32F, psamples + sstep0*w->sidx[j], sstep1*sizeof(psamples[0]) );
double val = predictTrees(Range(treeidx, treeidx+1), sample, predictFlags);
double sample_weight = w->sample_weights[w->sidx[j]];
if( !_isClassifier )
{
oobres[j] += val;
oobcount[j]++;
double true_val = w->ord_responses[w->sidx[j]];
double a = oobres[j]/oobcount[j] - true_val;
oobError += a*a;
oobError += sample_weight * a*a;
val = (val - true_val)/max_response;
ncorrect_responses += std::exp( -val*val );
}
@@ -237,7 +238,7 @@ public:
if( votes[best_class] < votes[k] )
best_class = k;
int diff = best_class != w->cat_responses[w->sidx[j]];
oobError += diff;
oobError += sample_weight * diff;
ncorrect_responses += diff == 0;
}
}
@@ -421,6 +422,10 @@ public:
}
}
double getOOBError() const {
return oobError;
}
RTreeParams rparams;
double oobError;
vector<float> varImportance;
@@ -500,6 +505,8 @@ public:
const vector<Node>& getNodes() const CV_OVERRIDE { return impl.getNodes(); }
const vector<Split>& getSplits() const CV_OVERRIDE { return impl.getSplits(); }
const vector<int>& getSubsets() const CV_OVERRIDE { return impl.getSubsets(); }
double getOOBError() const CV_OVERRIDE { return impl.getOOBError(); }
DTreesImplForRTrees impl;
};