int main(int argc, char ** argv)
{
try {
std::string data1Filename = "data/points_class1.xml";
std::string data2Filename = "data/points_class2.xml";
double locH = 40;
double oriH = .4;
std::vector<int> trainLabels, testLabels;
for (
unsigned i = 0; i < data1.
size(); ++i)
{
if (i%3 != 0)
{
trainData.
add(data1.
at(i));
trainLabels.push_back(1);
}
else
{
testData.
add(data1.
at(i));
testLabels.push_back(1);
}
}
for (
unsigned i = 0; i < data2.
size(); ++i)
{
if (i%3 != 0)
{
trainData.
add(data2.
at(i));
trainLabels.push_back(2);
}
else
{
testData.
add(data2.
at(i));
testLabels.push_back(2);
}
}
nuklei::GMatrix m = klr.
test(testData);
int nSuccess = 0;
for (
unsigned i = 0; i < testData.
size(); ++i)
{
if ((m(0,i) > .5 && testLabels.at(i) == 1) ||
(m(1,i) > .5 && testLabels.at(i) == 2) )
nSuccess++;
}
std::cout << double(nSuccess)/testData.
size() << std::endl;
return 0;
}
catch (std::exception &e) {
std::cerr << "Exception caught: ";
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}
catch (...) {
std::cerr << "Caught unknown exception." << std::endl;
return EXIT_FAILURE;
}
}