Commit ae9f80c1 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

Merge pull request #7855 from logic1988:master

parents 07004a46 de059567
......@@ -74,6 +74,7 @@ float StatModel::calcError( const Ptr<TrainData>& data, bool testerr, OutputArra
int i, n = (int)sidx.total();
bool isclassifier = isClassifier();
Mat responses = data->getResponses();
int responses_type = responses.type();
if( n == 0 )
n = data->getNSamples();
......@@ -91,7 +92,7 @@ float StatModel::calcError( const Ptr<TrainData>& data, bool testerr, OutputArra
int si = sidx_ptr ? sidx_ptr[i] : i;
Mat sample = layout == ROW_SAMPLE ? samples.row(si) : samples.col(si);
float val = predict(sample);
float val0 = responses.at<float>(si);
float val0 = (responses_type == CV_32S) ? (float)responses.at<int>(si) : responses.at<float>(si);
if( isclassifier )
err += fabs(val - val0) > FLT_EPSILON;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment