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

@ -431,10 +431,17 @@ 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++ )
{
if(!cvIsInf(data[j]))
{ {
double t = scale2*(1. - data[j])/(1. + data[j]); double t = scale2*(1. - data[j])/(1. + data[j]);
data[j] = t; data[j] = t;
} }
else
{
data[j] = -scale2;
}
}
} }
break; break;