[opengm] 283/386: add model print out in struct-max-margin iteration
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Aug 31 08:38:11 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 695964c3cfce7bb2ad06ba241085a2685af9f238
Author: Janez Ales <janez.ales at iwr.uni-heidelberg.de>
Date: Sat Oct 24 19:30:26 2015 +0200
add model print out in struct-max-margin iteration
---
include/opengm/learning/bundle-optimizer.hxx | 4 +---
include/opengm/learning/struct-max-margin.hxx | 19 ++++++++++---------
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/include/opengm/learning/bundle-optimizer.hxx b/include/opengm/learning/bundle-optimizer.hxx
index 7f99d5d..4be57e8 100644
--- a/include/opengm/learning/bundle-optimizer.hxx
+++ b/include/opengm/learning/bundle-optimizer.hxx
@@ -157,7 +157,7 @@ BundleOptimizer<T>::optimize(Oracle& oracle, Weights& w) {
t++;
- std::cout << std::endl << "----------------- iteration " << t << std::endl;
+ std::cout << std::endl << "-----------------------------------------------------------------------------> iteration " << t << std::endl;
Weights w_tm1 = w;
@@ -286,8 +286,6 @@ BundleOptimizer<T>::findMinLowerBound(ModelWeights& w, T& value) {
for (size_t i = 0; i < w.numberOfWeights(); i++)
w[i] = x[i];
- for (size_t i = 0; i < w.numberOfWeights(); i++)
- std::cout << "x[" << i << "]=" << x[i] << std::endl;
}
template <typename T>
diff --git a/include/opengm/learning/struct-max-margin.hxx b/include/opengm/learning/struct-max-margin.hxx
index 55b03a1..f3d0b72 100644
--- a/include/opengm/learning/struct-max-margin.hxx
+++ b/include/opengm/learning/struct-max-margin.hxx
@@ -99,10 +99,11 @@ private:
// set the weights w in E(x,y) and F(x,y)
_dataset.getWeights() = w;
-
+ std::cout << std::endl << " MODEL : ";
for (int i = 0; i < _dataset.getNumberOfModels(); i++) {
+ std::cout << i << " ";
- // get E(x,y) and F(x,y)
+ // get E(x,y) and F(x,y)
//std::cout << "locking model " << i << " of " << _dataset.getNumberOfModels() << std::endl;
_dataset.lockModel(i);
const GMType & gm = _dataset.getModel(i);
@@ -117,24 +118,24 @@ private:
// find the minimizer y* of F(y,w)
ConfigurationType mostViolated;
InferenceType inference(gml, _infParam);
- inference.infer();
+ inference.infer();
inference.arg(mostViolated);
// the optimal value of (1) is now c - F(y*,w)
- value += c - gml.evaluate(mostViolated);
+ value += c - gml.evaluate(mostViolated);
// the gradients are
typedef GradientAccumulator<Weights, ConfigurationType> GA;
- GA gaBestEffort(gradient, bestEffort, GA::Add);
- GA gaMostViolated(gradient, mostViolated, GA::Subtract);
- for (size_t j = 0; j < gm.numberOfFactors(); j++) {
+ GA gaBestEffort(gradient, bestEffort, GA::Add);
+ GA gaMostViolated(gradient, mostViolated, GA::Subtract);
+ for (size_t j = 0; j < gm.numberOfFactors(); j++) {
gm[j].callViFunctor(gaBestEffort);
gm[j].callViFunctor(gaMostViolated);
}
-
- _dataset.unlockModel(i);
+ _dataset.unlockModel(i);
}
+ std::cout << std::endl;
}
private:
--
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