[opengm] 93/386: inital version of grid search learner in python
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Aug 31 08:35:10 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 8115665e6bebd6d46b83f67527a5c3ca33de8d89
Author: DerThorsten <thorsten.beier at iwr.uni-heidelberg.de>
Date: Wed Dec 17 14:37:09 2014 +0100
inital version of grid search learner in python
---
src/interfaces/python/opengm/learning/learning.cxx | 4 ++--
.../python/opengm/learning/pyGridSearchLearner.cxx | 14 ++++++++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/interfaces/python/opengm/learning/learning.cxx b/src/interfaces/python/opengm/learning/learning.cxx
index 01eddb9..2f2e0a6 100644
--- a/src/interfaces/python/opengm/learning/learning.cxx
+++ b/src/interfaces/python/opengm/learning/learning.cxx
@@ -50,8 +50,8 @@ BOOST_PYTHON_MODULE_INIT(_learning) {
opengm::export_dataset<op::GmAdder, ol::GeneralizedHammingLoss >("DatasetWithGeneralizedHammingLoss");
- opengm::export_grid_search_learner<GmAdderHammingLossDataset>("GridSearch_HammingLoss");
- opengm::export_grid_search_learner<GmAdderGeneralizedHammingLossDataset>("GridSearch_GeneralizedHammingLoss");
+ opengm::export_grid_search_learner<op::GmAdderHammingLossDataset>("GridSearch_HammingLoss");
+ opengm::export_grid_search_learner<op::GmAdderGeneralizedHammingLossDataset>("GridSearch_GeneralizedHammingLoss");
diff --git a/src/interfaces/python/opengm/learning/pyGridSearchLearner.cxx b/src/interfaces/python/opengm/learning/pyGridSearchLearner.cxx
index 7d352eb..3fa1af6 100644
--- a/src/interfaces/python/opengm/learning/pyGridSearchLearner.cxx
+++ b/src/interfaces/python/opengm/learning/pyGridSearchLearner.cxx
@@ -5,6 +5,8 @@
#include <opengm/python/numpyview.hxx>
+#include <opengm/learning/gridsearch-learning.hxx>
+
namespace bp = boost::python;
namespace op = opengm::python;
@@ -18,12 +20,20 @@ namespace opengm{
template<class DATASET>
void export_grid_search_learner(const std::string & clsName){
typedef learning::GridSearchLearner<DATASET> PyLearner;
+ typedef typename PyLearner::Parameter PyLearnerParam;
+
+ const std::string paramClsName = clsName + std::string("Parameter");
+
- bp::class_<PyLearner>(clsName.c_str(),)
+ bp::class_<PyLearnerParam>(paramClsName.c_str(), bp::init<>())
+ ;
}
template void
- export_dataset<op::GmAdderHammingLossDataset> (const std::string& className);
+ export_grid_search_learner<op::GmAdderHammingLossDataset> (const std::string& className);
+
+ template void
+ export_grid_search_learner<op::GmAdderGeneralizedHammingLossDataset> (const std::string& className);
}
--
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