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

BUG: fix scale formula :1/stddev

No related merge requests found
Showing with 3 additions and 3 deletions
+3 -3
...@@ -52,7 +52,7 @@ void LearningApplicationBase<TInputValue, TOutputValue>::InitSharkKMeansParams() ...@@ -52,7 +52,7 @@ void LearningApplicationBase<TInputValue, TOutputValue>::InitSharkKMeansParams()
MandatoryOff("classifier.sharkkm.centroidstats"); MandatoryOff("classifier.sharkkm.centroidstats");
// Number of classes // Number of classes
AddParameter(ParameterType_String, "classifier.sharkkm.centroids", "Number of classes for the kmeans algorithm"); AddParameter(ParameterType_InputFilename, "classifier.sharkkm.centroids", "Number of classes for the kmeans algorithm");
SetParameterDescription("classifier.sharkkm.centroids", "The number of classes used for the kmeans algorithm. Default set to 2 class"); SetParameterDescription("classifier.sharkkm.centroids", "The number of classes used for the kmeans algorithm. Default set to 2 class");
MandatoryOff("classifier.sharkkm.centroids"); MandatoryOff("classifier.sharkkm.centroids");
} }
...@@ -73,7 +73,7 @@ void LearningApplicationBase<TInputValue, TOutputValue>::TrainSharkKMeans( ...@@ -73,7 +73,7 @@ void LearningApplicationBase<TInputValue, TOutputValue>::TrainSharkKMeans(
classifier->SetK( k ); classifier->SetK( k );
// Initialize centroids from file // Initialize centroids from file
if(HasValue("classifier.sharkkm.centroids")) if(IsParameterEnabled("classifier.sharkkm.centroids") && HasValue("classifier.sharkkm.centroids"))
{ {
shark::Data<shark::RealVector> centroidData; shark::Data<shark::RealVector> centroidData;
shark::importCSV(centroidData, GetParameterString( "classifier.sharkkm.centroids"), ' '); shark::importCSV(centroidData, GetParameterString( "classifier.sharkkm.centroids"), ' ');
...@@ -91,7 +91,7 @@ void LearningApplicationBase<TInputValue, TOutputValue>::TrainSharkKMeans( ...@@ -91,7 +91,7 @@ void LearningApplicationBase<TInputValue, TOutputValue>::TrainSharkKMeans(
assert(meanMeasurementVector.Size()==stddevMeasurementVector.Size()); assert(meanMeasurementVector.Size()==stddevMeasurementVector.Size());
for (unsigned int i = 0; i<meanMeasurementVector.Size(); ++i) for (unsigned int i = 0; i<meanMeasurementVector.Size(); ++i)
{ {
stddevMeasurementRV[i] = stddevMeasurementVector[i]; stddevMeasurementRV[i] = 1/stddevMeasurementVector[i];
// Substract the normalized mean // Substract the normalized mean
offsetRV[i] = - meanMeasurementVector[i]/stddevMeasurementVector[i]; offsetRV[i] = - meanMeasurementVector[i]/stddevMeasurementVector[i];
} }
......
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