From c9befeed1ef8b2418957c76cda9b749a0e99c698 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Traizet?= <cedric.traizet@c-s.fr>
Date: Tue, 30 Apr 2019 18:04:50 +0200
Subject: [PATCH] ENH: added output MSE parameter

---
 .../AppClassification/app/otbTrainVectorRegression.cxx    | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Modules/Applications/AppClassification/app/otbTrainVectorRegression.cxx b/Modules/Applications/AppClassification/app/otbTrainVectorRegression.cxx
index ce07691cb9..27d47c509b 100644
--- a/Modules/Applications/AppClassification/app/otbTrainVectorRegression.cxx
+++ b/Modules/Applications/AppClassification/app/otbTrainVectorRegression.cxx
@@ -66,6 +66,13 @@ protected:
     SetOfficialDocLink();
 
     Superclass::DoInit();
+    
+    AddParameter( ParameterType_Float , "io.mse" , "Mean Square Error" );
+    SetParameterDescription( "io.mse" ,
+      "Mean square error computed with the validation predictors" );
+    SetParameterRole( "io.mse" , Role_Output );
+    this->MandatoryOff( "io.mse" );
+
   }
 
   void DoUpdateParameters() override
@@ -105,6 +112,7 @@ protected:
     auto mse = ComputeMSE(m_ClassificationSamplesWithLabel.labeledListSample.GetPointer(), m_PredictedList.GetPointer() );
 
     otbAppLogINFO("Mean Square Error = "<<mse);
+    this->SetParameterFloat("io.mse",mse);
   }
   
 private:
-- 
GitLab