Commit d1403a13 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

ENH: added centroid input file to the parameter of the applications

No related merge requests found
Showing with 13 additions and 0 deletions
+13 -0
......@@ -80,6 +80,10 @@ protected:
SetParameterDescription("maxit", "Maximum number of iterations for the learning step.");
SetDefaultParameterInt("maxit", 1000);
MandatoryOff("maxit");
AddParameter(ParameterType_String, "incentroid", "Maximum number of iterations");
SetParameterDescription("incentroid", "Maximum number of iterations for the learning step.");
MandatoryOff("incentroid");
AddParameter(ParameterType_OutputFilename, "outmeans", "Centroid filename");
SetParameterDescription("outmeans", "Output text file containing centroid positions");
......@@ -248,6 +252,8 @@ protected:
GetParameterInt("maxit"));
GetInternalApplication("training")->SetParameterInt("classifier.sharkkm.k",
GetParameterInt("nc"));
GetInternalApplication("training")->SetParameterString("classifier.sharkkm.incentroid",
GetParameterString("incentroid"));
if( IsParameterEnabled("rand"))
GetInternalApplication("training")->SetParameterInt("rand", GetParameterInt("rand"));
......
......@@ -44,6 +44,12 @@ void LearningApplicationBase<TInputValue, TOutputValue>::InitSharkKMeansParams()
SetParameterInt("classifier.sharkkm.k", 2);
SetParameterDescription("classifier.sharkkm.k", "The number of classes used for the kmeans algorithm. Default set to 2 class");
SetMinimumParameterIntValue("classifier.sharkkm.k", 2);
// Number of classes
AddParameter(ParameterType_String, "classifier.sharkkm.incentroid", "Number of classes for the kmeans algorithm");
SetParameterDescription("classifier.sharkkm.incentroid", "The number of classes used for the kmeans algorithm. Default set to 2 class");
MandatoryOff("classifier.sharkkm.incentroid");
}
template<class TInputValue, class TOutputValue>
......@@ -60,6 +66,7 @@ void LearningApplicationBase<TInputValue, TOutputValue>::TrainSharkKMeans(
classifier->SetInputListSample( trainingListSample );
classifier->SetTargetListSample( trainingLabeledListSample );
classifier->SetK( k );
classifier->SetCentroidFilename( GetParameterString( "classifier.sharkkm.incentroid") );
classifier->SetMaximumNumberOfIterations( nbMaxIter );
classifier->Train();
classifier->Save( modelPath );
......
Supports Markdown
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