[opengm] 11/386: start hammingloss

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Aug 31 08:34:59 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository opengm.

commit d3b506185867b38e880f5675ff07c1a584bd6a56
Author: joergkappes <kappes at math.uni-heidelberg.de>
Date:   Fri May 16 17:08:55 2014 +0200

    start hammingloss
---
 include/opengm/learning/loss/hammingloss.hxx | 36 +++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/include/opengm/learning/loss/hammingloss.hxx b/include/opengm/learning/loss/hammingloss.hxx
index 8ab0305..5d8eb72 100644
--- a/include/opengm/learning/loss/hammingloss.hxx
+++ b/include/opengm/learning/loss/hammingloss.hxx
@@ -1 +1,35 @@
-//todo Joerg
+#include "opengm/functions/explicit_function.hxx"
+
+
+class HammingLoss{
+public:
+
+   template<class IT1, class IT2>
+   double loss(IT1 labelBegin, IT1 labelEnd, IT2 GTBegin,IT2 GTEnd) const;
+  
+   template<class GM, class IT>
+   void addLoss(GM& gm, IT GTBegin) const;
+private:
+};
+
+template<class IT1, class IT2>
+double HammingLoss::loss(IT1 labelBegin, const IT1 labelEnd, IT2 GTBegin, const IT2 GTEnd) const
+{
+   double loss = 0;
+   for(; labelBegin!= labelEnd; ++labelBegin, ++GTBegin){
+      if(*labelBegin != *GTBegin){
+         loss += 1.0;
+      }
+   }
+}
+
+template<class GM, class IT>
+void HammingLoss::addLoss(GM& gm, IT GTBegin) const
+{
+
+   for(typename GM::IndexType i=0; i<gm.numberOfVariables(); ++i){
+      typename GM::LabelType numL = gm.numberOFLabels(i);
+      //todo add functions and factors
+   }
+}
+  

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opengm.git



More information about the debian-science-commits mailing list