[opengm] 285/386: adding normalized weights print output (only for check of convergence - not to be used in calculation)

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Aug 31 08:38:12 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 6fb911920d35ed5b266392b1e2fafd8b3cd33661
Author: Janez Ales <janez.ales at iwr.uni-heidelberg.de>
Date:   Mon Nov 2 19:51:49 2015 +0100

    adding normalized weights print output (only for check of convergence - not to be used in calculation)
---
 include/opengm/learning/bundle-optimizer.hxx | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/opengm/learning/bundle-optimizer.hxx b/include/opengm/learning/bundle-optimizer.hxx
index 4be57e8..9f7c094 100644
--- a/include/opengm/learning/bundle-optimizer.hxx
+++ b/include/opengm/learning/bundle-optimizer.hxx
@@ -200,18 +200,22 @@ BundleOptimizer<T>::optimize(Oracle& oracle, Weights& w) {
 		// minimal value of lower bound
 		T minLower;
 
-        std::cout << "w before findMinLowerBound: ";
-        for(size_t i=0; i<w.size(); ++i)
-            std::cout << w[i] << " ";
-        std::cout << std::endl;
-
         // update w and get minimal value
 		findMinLowerBound(w, minLower);
 
-		std::cout << " min_w ℒ(w)   + ½λ|w|²   is: " << minLower << std::endl;
+        // norm of w
+        double norm = 0.0;
+        for(size_t i=0; i<w.size(); ++i)
+            norm += w[i]*w[i];
+        norm = std::sqrt(norm);
+
+        std::cout << " min_w ℒ(w)   + ½λ|w|²   is: " << minLower << std::endl;
         std::cout << " w* of ℒ(w)   + ½λ|w|²   is: (";
         for(size_t i=0; i<w.size(); ++i)
             std::cout << w[i] << " ";
+        std::cout << ")              normalized: (";
+        for(size_t i=0; i<w.size(); ++i)
+            std::cout << w[i]/norm << " ";
         std::cout << ")" << std::endl;
 
 		// compute gap

-- 
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