Ask Your Question

Revision history [back]

I think something is wrong in your data file (data.csv) :

1,2,3,7,2
7,1,7,7,5
9,7,5,3,2
12,21,32,71,8

trainData

[1, 2, 3, 7;
 7, 1, 7, 7;
 9, 7, 5, 3;
 12, 21, 32, 71]

trainLabels :

[2;
 5;
 2;
 8]

Train labels 5 and 8 with only 3 classes it is not possible.

exception : int id = (int)trainLabels.at<float>(i); hot.at<float>(i, id) = 1.0f;

id >=3 with only 3 columns

label for csv file is described here :

responseStartIdx Index of the first output variable. If -1, the function considers the last variable as the response