[opengm] 104/386: BAZINGA bitches, its working
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Aug 31 08:35: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 8649a8bc3dc1e4bb49dd879937ce8dc96cb9f7ae
Author: DerThorsten <thorsten.beier at iwr.uni-heidelberg.de>
Date: Wed Dec 17 15:14:34 2014 +0100
BAZINGA bitches, its working
---
include/opengm/learning/gridsearch-learning.hxx | 5 +++--
.../python/opengm/learning/pyGridSearchLearner.cxx | 17 +++++++++++++++--
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/include/opengm/learning/gridsearch-learning.hxx b/include/opengm/learning/gridsearch-learning.hxx
index fd78ed3..3650e1e 100644
--- a/include/opengm/learning/gridsearch-learning.hxx
+++ b/include/opengm/learning/gridsearch-learning.hxx
@@ -12,6 +12,7 @@ namespace opengm {
class GridSearchLearner
{
public:
+ typedef DATASET DatasetType;
typedef typename DATASET::GMType GMType;
typedef typename DATASET::LossType LossType;
typedef typename GMType::ValueType ValueType;
@@ -30,7 +31,7 @@ namespace opengm {
GridSearchLearner(DATASET&, const Parameter& );
template<class INF>
- void learn(typename INF::Parameter& para);
+ void learn(const typename INF::Parameter& para);
//template<class INF, class VISITOR>
//void learn(typename INF::Parameter para, VITITOR vis);
@@ -59,7 +60,7 @@ namespace opengm {
template<class DATASET>
template<class INF>
- void GridSearchLearner<DATASET>::learn(typename INF::Parameter& para){
+ void GridSearchLearner<DATASET>::learn(const typename INF::Parameter& para){
// generate model Parameters
opengm::learning::Weights<double> modelPara( dataset_.getNumberOfWeights() );
opengm::learning::Weights<double> bestModelPara( dataset_.getNumberOfWeights() );
diff --git a/src/interfaces/python/opengm/learning/pyGridSearchLearner.cxx b/src/interfaces/python/opengm/learning/pyGridSearchLearner.cxx
index 3fa1af6..e8f9cfb 100644
--- a/src/interfaces/python/opengm/learning/pyGridSearchLearner.cxx
+++ b/src/interfaces/python/opengm/learning/pyGridSearchLearner.cxx
@@ -4,7 +4,7 @@
#include <opengm/python/converter.hxx>
#include <opengm/python/numpyview.hxx>
-
+#include <opengm/inference/icm.hxx>
#include <opengm/learning/gridsearch-learning.hxx>
@@ -14,19 +14,32 @@ namespace ol = opengm::learning;
namespace opengm{
+ template<class LEARNER>
+ void pyLearnDummy(LEARNER & learner){
-
+ typedef typename LEARNER::GMType GMType;
+ typedef opengm::ICM<GMType, opengm::Minimizer> Inf;
+ typedef typename Inf::Parameter InfParam;
+ InfParam infParam;
+ learner. template learn<Inf>(infParam);
+ }
template<class DATASET>
void export_grid_search_learner(const std::string & clsName){
typedef learning::GridSearchLearner<DATASET> PyLearner;
typedef typename PyLearner::Parameter PyLearnerParam;
+ typedef typename PyLearner::GMType GMType;
+ typedef typename PyLearner::DatasetType DatasetType;
const std::string paramClsName = clsName + std::string("Parameter");
bp::class_<PyLearnerParam>(paramClsName.c_str(), bp::init<>())
;
+
+ bp::class_<PyLearner>( clsName.c_str(), bp::init<DatasetType &, const PyLearnerParam &>() )
+ .def("learn",&pyLearnDummy<PyLearner>)
+ ;
}
template void
--
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