Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to load data Matrix for svm

i have extracted features data in .csv files. For each feature there are 5 .csv file and i have 13 features so there are around 50 files containing feature data. The data type is float/double.

// Set up training data
float labels[4] = {1.0, -1.0, -1.0, -1.0};
Mat labelsMat(4, 1, CV_32FC1, labels);

float trainingData[4][2] = { {501, 10}, {255, 10}, {501, 255}, {10, 501} };
Mat trainingDataMat(4, 2, CV_32FC1, trainingData);

In here training data is a 4x2 matrix. but my files have around 900x400 data and all the files are not the same. (eg: 900x420, 900x380, 900x450)

Now i want to load this data in to svm training data. How can i do this?

How to load data Matrix for svm

i have extracted features data in .csv files. For each feature there are 5 .csv file and i have 13 features so there are around 50 files containing feature data. The data type is float/double.

// Set up training data
float labels[4] = {1.0, -1.0, -1.0, -1.0};
Mat labelsMat(4, 1, CV_32FC1, labels);

float trainingData[4][2] = { {501, 10}, {255, 10}, {501, 255}, {10, 501} };
Mat trainingDataMat(4, 2, CV_32FC1, trainingData);

In here training data is a 4x2 matrix. but my files have around 900x400 data and all the files are not the same. (eg: 900x420, 900x380, 900x450)

Now i want to load this data in to svm training data. How can i do this?

CSV Files

Data in a CSV file