ANN prediction
I am using CvANN_MLP. When I call predict(), I don't get the same responses when I give all the data at once (1 row = vector) and when I make a loop and submit the vector one by one myself.
Here are my 2 solutions :
solution1 :
for (int z = 0; z<valid_data.rows; z++)
{
Mat sample = valid_data.row(z);
Mat result_test = Mat(1, 1, CV_32FC1);
ann.predict(sample, result_test);
result_.at<float>(z) = result_test.at<float>(0);
}
solution2 :
float res = ann.predict(valid_data, result_);
They don't give the same result, but they sould right?
yes, they should. and i get the same result both ways here !
could you explain, where your results differ ?
Hi Berak, Thank you for your reply. I get the same result for most cases, but for some rows, the response differs. For example, for the input data I have column1 for solution1 and column2 for solution2 :
Column1 Column2
1.80621 1.80621
1.80621 1.80621
1.80621 1.80621
1.80621 1.80621
1.80621 1.80621
1.80621 1.80621
1.80621 1.80621
-0.309371 -0.309371
1.80621 -0.309371
-0.309371 -0.309371
-0.309371 -0.309371
-0.309371 -0.309371
-0.309371 -0.309371
-0.309371 -0.309371
-0.309371 -0.309371
-0.309371 -0.309371
-0.309371 -0.309371
-0.309371 -0.309371
-0.309371 -0.309371
-0.309371 -0.309371
-0.309371 -0.309371
-0.309371 1.80621
1.80621 1.80621
-0.309371 1.80621
1.80621 1.80621
1.80621 1.80621
1.80621 1.80621
1.80621 1 ...(more)
I am using OpenCV 2.4.3 version.
ah, nice update !