From ba09b3e7880400c27356273a3490a30691972e31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Traizet?= <cedric.traizet@c-s.fr> Date: Wed, 17 Apr 2019 17:32:17 +0200 Subject: [PATCH] ENH: remove TrainNormalizer --- .../include/otbTrainSharkKMeans.hxx | 1 + .../include/otbSharkKMeansMachineLearningModel.h | 4 ---- .../include/otbSharkKMeansMachineLearningModel.hxx | 13 ------------- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/Modules/Applications/AppClassification/include/otbTrainSharkKMeans.hxx b/Modules/Applications/AppClassification/include/otbTrainSharkKMeans.hxx index 12641430e5..f703503935 100644 --- a/Modules/Applications/AppClassification/include/otbTrainSharkKMeans.hxx +++ b/Modules/Applications/AppClassification/include/otbTrainSharkKMeans.hxx @@ -23,6 +23,7 @@ #include "otbLearningApplicationBase.h" #include "otbSharkKMeansMachineLearningModel.h" #include "otbStatisticsXMLFileReader.h" +#include "shark/Models/Normalizer.h" namespace otb { diff --git a/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.h b/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.h index d42e748194..4c877a5d50 100644 --- a/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.h +++ b/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.h @@ -48,7 +48,6 @@ #include "shark/Models/Clustering/Centroids.h" #include "shark/Models/Clustering/ClusteringModel.h" #include "shark/Algorithms/KMeans.h" -#include "shark/Algorithms/Trainers/NormalizeComponentsUnitVariance.h" #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop @@ -146,9 +145,6 @@ protected: virtual void DoPredictBatch(const InputListSampleType *, const unsigned int &startIndex, const unsigned int &size, TargetListSampleType *, ConfidenceListSampleType * = nullptr, ProbaListSampleType * = nullptr) const override; - template<typename DataType> - shark::Normalizer<> TrainNormalizer(const DataType &data) const; - /** PrintSelf method */ void PrintSelf(std::ostream &os, itk::Indent indent) const override; diff --git a/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.hxx b/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.hxx index ff95c9501a..f4b69b4592 100644 --- a/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.hxx +++ b/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.hxx @@ -35,7 +35,6 @@ #include "otb_shark.h" #include "otbSharkUtils.h" -#include "shark/Algorithms/Trainers/NormalizeComponentsUnitVariance.h" //normalize #include "shark/Algorithms/KMeans.h" //k-means algorithm #include "shark/Models/Clustering/HardClusteringModel.h" #include "shark/Models/Clustering/SoftClusteringModel.h" @@ -82,18 +81,6 @@ SharkKMeansMachineLearningModel<TInputValue, TOutputValue> m_ClusteringModel = boost::make_shared<ClusteringModelType>( &m_Centroids ); } -template<class TInputValue, class TOutputValue> -template<typename DataType> -shark::Normalizer<> -SharkKMeansMachineLearningModel<TInputValue, TOutputValue> -::TrainNormalizer(const DataType &data) const -{ - shark::Normalizer<> normalizer; - shark::NormalizeComponentsUnitVariance<> normalizingTrainer( true );//zero mean - normalizingTrainer.train( normalizer, data ); - return normalizer; -} - template<class TInputValue, class TOutputValue> typename SharkKMeansMachineLearningModel<TInputValue, TOutputValue> ::TargetSampleType -- GitLab