Commit edb6a0e8 authored by Tauranis's avatar Tauranis

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

parent 2f0676fb
...@@ -432,8 +432,15 @@ public: ...@@ -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;
......
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