Commit 316cd8e0 authored by Antoine Regimbeau's avatar Antoine Regimbeau

Bug fixed. We might want to check the behavior of the nu classification as...

Bug fixed. We might want to check the behavior of the nu classification as there is a lot of value that are not acceptable. Either it is the model then it's okay or it's a method that does a strange manipulation changing its value.
parent 2d0c7c01
...@@ -97,6 +97,12 @@ namespace Wrapper ...@@ -97,6 +97,12 @@ namespace Wrapper
SetParameterDescription("classifier.libsvm.c", SetParameterDescription("classifier.libsvm.c",
"SVM models have a cost parameter C (1 by default) to control the " "SVM models have a cost parameter C (1 by default) to control the "
"trade-off between training errors and forcing rigid margins."); "trade-off between training errors and forcing rigid margins.");
AddParameter(ParameterType_Float, "classifier.libsvm.nu", "Cost parameter Nu");
SetParameterFloat("classifier.libsvm.nu",0.5, false);
SetParameterDescription("classifier.libsvm.nu",
"Cost parameter Nu, in the range 0..1, the larger the value, "
"the smoother the decision.");
// It seems that it miss a nu parameter for the nu-SVM use. // It seems that it miss a nu parameter for the nu-SVM use.
AddParameter(ParameterType_Empty, "classifier.libsvm.opt", "Parameters optimization"); AddParameter(ParameterType_Empty, "classifier.libsvm.opt", "Parameters optimization");
...@@ -111,12 +117,14 @@ namespace Wrapper ...@@ -111,12 +117,14 @@ namespace Wrapper
AddParameter(ParameterType_Float, "classifier.libsvm.eps", "Epsilon"); AddParameter(ParameterType_Float, "classifier.libsvm.eps", "Epsilon");
SetParameterFloat("classifier.libsvm.eps",1e-3, false); SetParameterFloat("classifier.libsvm.eps",1e-3, false);
SetParameterDescription("classifier.libsvm.eps", SetParameterDescription("classifier.libsvm.eps",
"Parameter for the epsilon regression mode."); "The distance between feature vectors from the training set and "
AddParameter(ParameterType_Float, "classifier.libsvm.nu", "Nu"); "the fitting hyper-plane must be less than Epsilon. For outliers"
SetParameterFloat("classifier.libsvm.nu",0.5, false); "the penalty mutliplier is set by C.");
SetParameterDescription("classifier.libsvm.nu", // AddParameter(ParameterType_Float, "classifier.libsvm.nu", "Nu");
"Cost parameter Nu, in the range 0..1, the larger the value, " // SetParameterFloat("classifier.libsvm.nu",0.5, false);
"the smoother the decision."); // SetParameterDescription("classifier.libsvm.nu",
// "Cost parameter Nu, in the range 0..1, the larger the value, "
// "the smoother the decision.");
} }
} }
...@@ -142,6 +150,7 @@ namespace Wrapper ...@@ -142,6 +150,7 @@ namespace Wrapper
{ {
libSVMClassifier->SetDoProbabilityEstimates(true); libSVMClassifier->SetDoProbabilityEstimates(true);
} }
libSVMClassifier->SetNu(GetParameterFloat("classifier.libsvm.nu"));
libSVMClassifier->SetC(GetParameterFloat("classifier.libsvm.c")); libSVMClassifier->SetC(GetParameterFloat("classifier.libsvm.c"));
switch (GetParameterInt("classifier.libsvm.k")) switch (GetParameterInt("classifier.libsvm.k"))
...@@ -177,7 +186,6 @@ namespace Wrapper ...@@ -177,7 +186,6 @@ namespace Wrapper
break; break;
} }
libSVMClassifier->SetEpsilon(GetParameterFloat("classifier.libsvm.eps")); libSVMClassifier->SetEpsilon(GetParameterFloat("classifier.libsvm.eps"));
libSVMClassifier->SetNu(GetParameterFloat("classifier.libsvm.nu"));
} }
else else
{ {
...@@ -197,6 +205,7 @@ namespace Wrapper ...@@ -197,6 +205,7 @@ namespace Wrapper
break; break;
} }
} }
libSVMClassifier->Train(); libSVMClassifier->Train();
libSVMClassifier->Save(modelPath); libSVMClassifier->Save(modelPath);
......
...@@ -141,7 +141,7 @@ public: ...@@ -141,7 +141,7 @@ public:
return m_Parameters.coef0; return m_Parameters.coef0;
} }
/** Set the C parameter for the training for C_SVC, EPSILON_SVR and NU_SVR */ /** Set the C parameter for the training for C_SVC, EPSILON_SVR and C_SVR */
otbSetSVMParameterMacro(C,C,double) otbSetSVMParameterMacro(C,C,double)
/** Get the C parameter for the training for C_SVC, EPSILON_SVR and NU_SVR */ /** Get the C parameter for the training for C_SVC, EPSILON_SVR and NU_SVR */
......
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