[opengm] 129/386: use multiple models in test_learning
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Aug 31 08:36:04 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 1a1e177afc6676054990c9f2a1d80010665606da
Author: Jan Funke <funke at ini.ch>
Date: Thu Dec 18 16:16:55 2014 +0100
use multiple models in test_learning
---
src/unittest/learning/test_learning.cxx | 35 +++++++++++++++++----------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/src/unittest/learning/test_learning.cxx b/src/unittest/learning/test_learning.cxx
index 99b03ee..2eed459 100644
--- a/src/unittest/learning/test_learning.cxx
+++ b/src/unittest/learning/test_learning.cxx
@@ -48,26 +48,26 @@ int main() {
std::cout << " Includes are fine :-) " << std::endl;
{
- DSS dataset;
+ DSS dataset(5);
std::cout << "Dataset includes " << dataset.getNumberOfModels() << " instances and has " << dataset.getNumberOfWeights() << " parameters."<<std::endl;
- opengm::learning::StructMaxMargin<DSS>::Parameter para;
- opengm::learning::StructMaxMargin<DSS> learner(dataset,para);
+ opengm::learning::StructMaxMargin<DSS>::Parameter para;
+ opengm::learning::StructMaxMargin<DSS> learner(dataset,para);
INF::Parameter infPara;
infPara.integerConstraint_ = true;
learner.learn<INF>(infPara);
- const DSS::Weights& weights = learner.getWeights();
- std::cout <<"Weights: ";
- for (size_t i=0; i<weights.numberOfWeights(); ++i)
- std::cout << weights[i] <<" ";
- std::cout <<std::endl;
+ const DSS::Weights& weights = learner.getWeights();
+ std::cout <<"Weights: ";
+ for (size_t i=0; i<weights.numberOfWeights(); ++i)
+ std::cout << weights[i] <<" ";
+ std::cout <<std::endl;
}
{
- DS1 dataset;
+ DS1 dataset(4);
std::cout << "Dataset includes " << dataset.getNumberOfModels() << " instances and has " << dataset.getNumberOfWeights() << " parameters."<<std::endl;
@@ -87,22 +87,23 @@ int main() {
}
{
- DS2 dataset;
+ DS2 dataset(4);
std::cout << "Dataset includes " << dataset.getNumberOfModels() << " instances and has " << dataset.getNumberOfWeights() << " parameters."<<std::endl;
- opengm::learning::StructMaxMargin<DS2>::Parameter para;
- opengm::learning::StructMaxMargin<DS2> learner(dataset,para);
+ opengm::learning::StructMaxMargin<DS2>::Parameter para;
+ para.optimizerParameter_.lambda = 1000.0;
+ opengm::learning::StructMaxMargin<DS2> learner(dataset,para);
INF::Parameter infPara;
infPara.integerConstraint_ = true;
learner.learn<INF>(infPara);
- const DS2::Weights& weights = learner.getWeights();
- std::cout <<"Weights: ";
- for (size_t i=0; i<weights.numberOfWeights(); ++i)
- std::cout << weights[i] <<" ";
- std::cout <<std::endl;
+ const DS2::Weights& weights = learner.getWeights();
+ std::cout <<"Weights: ";
+ for (size_t i=0; i<weights.numberOfWeights(); ++i)
+ std::cout << weights[i] <<" ";
+ std::cout <<std::endl;
}
--
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