Bug fix for MLP predict for small values to avoid nan responses.

This commit is contained in:
Tauranis 2016-04-12 08:28:38 -03:00
parent 2f0676fb88
commit edb6a0e889

View File

@ -432,8 +432,15 @@ public:
double* data = sums.ptr<double>(i); double* data = sums.ptr<double>(i);
for( j = 0; j < cols; j++ ) for( j = 0; j < cols; j++ )
{ {
double t = scale2*(1. - data[j])/(1. + data[j]); if(!cvIsInf(data[j]))
data[j] = t; {
double t = scale2*(1. - data[j])/(1. + data[j]);
data[j] = t;
}
else
{
data[j] = -scale2;
}
} }
} }
break; break;