Commit 3b899121 authored by Cyrille Valladeau's avatar Cyrille Valladeau
Browse files

Correction SVMModelGenericKernelsTest

parent 1ea3f5a8
......@@ -263,8 +263,49 @@ ADD_TEST(leTvSVMImageClassificationFilter ${LEARNING_TESTS3}
${INPUTDATA}/svm_model_image
${TEMP}/leSVMImageClassificationFilterOutput.tif)
ADD_TEST(leTuSVMModelGenericKernelsTest ${LEARNING_TESTS3}
otbSVMModelGenericKernelsTest)
ADD_TEST(leTvSVMModelGenericKernelsTest ${LEARNING_TESTS3}
--compare-n-ascii ${TOL} 13
${BASELINE_FILES}/leTvSVMModelGenericKernelsTest1.txt
${TEMP}/leTvSVMModelGenericKernelsTest1.txt
${BASELINE_FILES}/leTvSVMModelGenericKernelsTest2.txt
${TEMP}/leTvSVMModelGenericKernelsTest2.txt
${BASELINE_FILES}/leTvSVMModelGenericKernelsTest3.txt
${TEMP}/leTvSVMModelGenericKernelsTest3.txt
${BASELINE_FILES}/leTvSVMModelGenericKernelsTest4.txt
${TEMP}/leTvSVMModelGenericKernelsTest4.txt
${BASELINE_FILES}/leTvSVMModelGenericKernelsTest5.txt
${TEMP}/leTvSVMModelGenericKernelsTest5.txt
${BASELINE_FILES}/leTvSVMModelGenericKernelsTest6.txt
${TEMP}/leTvSVMModelGenericKernelsTest6.txt
${BASELINE_FILES}/leTvSVMModelGenericKernelsTest7.txt
${TEMP}/leTvSVMModelGenericKernelsTest7.txt
${BASELINE_FILES}/leTvSVMModelGenericKernelsTest8.txt
${TEMP}/leTvSVMModelGenericKernelsTest8.txt
${BASELINE_FILES}/leTvSVMModelGenericKernelsTest9.txt
${TEMP}/leTvSVMModelGenericKernelsTest9.txt
${BASELINE_FILES}/leTvSVMModelGenericKernelsTest10.txt
${TEMP}/leTvSVMModelGenericKernelsTest10.txt
${BASELINE_FILES}/leTvSVMModelGenericKernelsTest11.txt
${TEMP}/leTvSVMModelGenericKernelsTest11.txt
${BASELINE_FILES}/leTvSVMModelGenericKernelsTest12.txt
${TEMP}/leTvSVMModelGenericKernelsTest12.txt
${BASELINE_FILES}/leTvSVMModelGenericKernelsTest13.txt
${TEMP}/leTvSVMModelGenericKernelsTest13.txt
otbSVMModelGenericKernelsTest
${TEMP}/leTvSVMModelGenericKernelsTest1.txt
${TEMP}/leTvSVMModelGenericKernelsTest2.txt
${TEMP}/leTvSVMModelGenericKernelsTest3.txt
${TEMP}/leTvSVMModelGenericKernelsTest4.txt
${TEMP}/leTvSVMModelGenericKernelsTest5.txt
${TEMP}/leTvSVMModelGenericKernelsTest6.txt
${TEMP}/leTvSVMModelGenericKernelsTest7.txt
${TEMP}/leTvSVMModelGenericKernelsTest8.txt
${TEMP}/leTvSVMModelGenericKernelsTest9.txt
${TEMP}/leTvSVMModelGenericKernelsTest10.txt
${TEMP}/leTvSVMModelGenericKernelsTest11.txt
${TEMP}/leTvSVMModelGenericKernelsTest12.txt
${TEMP}/leTvSVMModelGenericKernelsTest13.txt
)
ADD_TEST(leTvSVMModelCopy ${LEARNING_TESTS3}
......
......@@ -52,8 +52,6 @@ int otbSVMModelGenericKernelsTest( int argc, char* argv[] )
otb::GroupedRBFKernelFunctor groupedRBFFunctor;
otb::GroupingAdaptiveKernelFunctor groupingAdaptiveFunctor;
invMultiQuadricFunctor.SetValue<double>("const_coef", 2.);
invMultiQuadraticSAMFunctor.SetValue<double>("const_coef", 3.);
kModFunctor.SetValue<double>("const_coef", 1.5);
......@@ -63,14 +61,15 @@ int otbSVMModelGenericKernelsTest( int argc, char* argv[] )
polyRBFSAMFunctor.SetValue<double>("lin_coef", 1.2);
groupingAdaptiveFunctor.SetValue<double>("const_coef", 8.2);
groupingAdaptiveFunctor.SetValue<double>("lin_coef", 5.2);
struct svm_model *model;
model = (struct svm_model *)malloc(sizeof(struct svm_model));
model->param.svm_type = 0;
model->param.kernel_type = 5;
model->nr_class = 2;
model->l = 5;
model->sv_coef = Malloc(double *,model->nr_class-1);
for(int i=0; i<model->nr_class-1; i++)
model->sv_coef[i] = Malloc(double,model->l);
model->SV = Malloc(svm_node*,model->l);
......@@ -80,7 +79,7 @@ int otbSVMModelGenericKernelsTest( int argc, char* argv[] )
model->SV[n]->index = -1;
model->SV[n]->value = 0.;
}
model->sv_coef[0][0] = 0.125641;
model->sv_coef[0][1] = 1;
model->sv_coef[0][2] = 0;
......@@ -97,7 +96,7 @@ int otbSVMModelGenericKernelsTest( int argc, char* argv[] )
model->param.lin_coef = 5.;
model->param.gamma = 1.5;
model->param.degree = 2;
struct svm_node *p = Malloc(struct svm_node,20);
for(unsigned int n = 0;n<20;++n)
{
......@@ -151,47 +150,46 @@ p[19].index = -1;
model->nSV = Malloc(int,2);
model->nSV[0] = 3;
model->nSV[1] = 2;
model->param.kernel_generic = &customFunctor;
svmModel->SetModel(model);
svmModel->SaveModel("../../Temporary/leTuKernelsTestRes1");
svmModel->SaveModel(argv[1]);
model->param.kernel_generic = &invMultiQuadricFunctor;
svmModel->SetModel(model);
svmModel->SaveModel("../../Temporary/leTuKernelsTestRes2");
svmModel->SaveModel(argv[2]);
model->param.kernel_generic = &SAMFunctor;
svmModel->SetModel(model);
svmModel->SaveModel("../../Temporary/leTuKernelsTestRes3");
svmModel->SaveModel(argv[3]);
model->param.kernel_generic = &kModFunctor;
svmModel->SetModel(model);
svmModel->SaveModel("../../Temporary/leTuKernelsTestRes4");
svmModel->SaveModel(argv[4]);
model->param.kernel_generic = &radialSAMFunctor;
svmModel->SetModel(model);
svmModel->SaveModel("../../Temporary/leTuKernelsTestRes5");
svmModel->SaveModel(argv[5]);
model->param.kernel_generic = &invMultiQuadraticSAMFunctor;
svmModel->SetModel(model);
svmModel->SaveModel("../../Temporary/leTuKernelsTestRes6");
svmModel->SaveModel(argv[6]);
model->param.kernel_generic = &KModSAMFunctor;
svmModel->SetModel(model);
svmModel->SaveModel("../../Temporary/leTuKernelsTestRes7");
svmModel->SaveModel(argv[7]);
model->param.kernel_generic = &RBFRBFSAMFunctor;
svmModel->SetModel(model);
svmModel->SaveModel("../../Temporary/leTuKernelsTestRes8");
svmModel->SaveModel(argv[8]);
model->param.kernel_generic = &polyRBFSAMFunctor;
svmModel->SetModel(model);
svmModel->SaveModel("../../Temporary/leTuKernelsTestRes9");
svmModel->SaveModel(argv[9]);
model->param.kernel_generic = &RBFDiffFunctor;
svmModel->SetModel(model);
svmModel->SaveModel("../../Temporary/leTuKernelsTestRes10");
svmModel->SaveModel(argv[10]);
model->param.kernel_generic = &customLinearFunctor;
svmModel->SetModel(model);
svmModel->SaveModel("../../Temporary/leTuKernelsTestRes11");
svmModel->SaveModel(argv[11]);
model->param.kernel_generic = &groupedRBFFunctor;
svmModel->SetModel(model);
svmModel->SaveModel("../../Temporary/leTuKernelsTestRes12");
svmModel->SaveModel(argv[12]);
model->param.kernel_generic = &groupingAdaptiveFunctor;
svmModel->SetModel(model);
svmModel->SaveModel("../../Temporary/leTuKernelsTestRes13");
svmModel->SaveModel(argv[13]);
return EXIT_SUCCESS;
}
......
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