[opengm] 331/386: removed learning wip

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Aug 31 08:38:24 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 148769919324737ed258eb24db07904a9337e119
Author: DerThorsten <thorsten.beier at iwr.uni-heidelberg.de>
Date:   Fri Mar 25 12:50:51 2016 +0100

    removed learning wip
---
 include/opengm/python/opengmpython.hxx           |  6 +-
 src/interfaces/python/opengm/opengmcore/pyGm.cxx | 15 +----
 src/unittest/CMakeLists.txt                      |  4 --
 src/unittest/test_learnable_functions.cxx        | 79 ------------------------
 4 files changed, 4 insertions(+), 100 deletions(-)

diff --git a/include/opengm/python/opengmpython.hxx b/include/opengm/python/opengmpython.hxx
index 2737230..a8a7481 100644
--- a/include/opengm/python/opengmpython.hxx
+++ b/include/opengm/python/opengmpython.hxx
@@ -70,7 +70,7 @@ namespace python{
             PyPottsGFunction,
             PyTruncatedAbsoluteDifferenceFunction,
             PyTruncatedSquaredDifferenceFunction,
-            PySparseFunction,
+            PySparseFunction
             //PyLPottsFunction,
             //PyLUnaryFunction
         >::type type;
@@ -110,10 +110,6 @@ namespace python{
    >::type   GmAdder;
 
 
-   typedef opengm::datasets::EditableDataset<GmAdder, opengm::learning::HammingLoss > GmAdderHammingLossDataset;
-   typedef opengm::datasets::EditableDataset<GmAdder, opengm::learning::GeneralizedHammingLoss > GmAdderGeneralizedHammingLossDataset;
-   typedef opengm::datasets::EditableDataset<GmAdder, opengm::learning::FlexibleLoss > GmAdderFlexibleLossDataset;
-
    typedef GmAdder::FactorType FactorGmAdder;
    typedef FactorGmAdder GmAdderFactor;
 
diff --git a/src/interfaces/python/opengm/opengmcore/pyGm.cxx b/src/interfaces/python/opengm/opengmcore/pyGm.cxx
index 1b2c6cf..165ecc1 100644
--- a/src/interfaces/python/opengm/opengmcore/pyGm.cxx
+++ b/src/interfaces/python/opengm/opengmcore/pyGm.cxx
@@ -682,8 +682,7 @@ namespace pygm {
          typedef opengm::SquaredDifferenceFunction             <ValueType,IndexType,LabelType> PySquaredDifferenceFunction;
          typedef opengm::TruncatedSquaredDifferenceFunction    <ValueType,IndexType,LabelType> PyTruncatedSquaredDifferenceFunction;
          typedef opengm::SparseFunction                        <ValueType,IndexType,LabelType> PySparseFunction; 
-         typedef opengm::functions::learnable::LPotts          <ValueType,IndexType,LabelType> PyLPottsFunction;
-         typedef opengm::functions::learnable::LUnary          <ValueType,IndexType,LabelType> PyLUnaryFunction;
+       
 
          if(fname==std::string("explicit")){
             return gm. template  reserveFunctions<PyExplicitFunction>(size);
@@ -706,12 +705,6 @@ namespace pygm {
          else if(fname==std::string("sparse")){
             return gm. template  reserveFunctions<PySparseFunction>(size);
          }
-         else if(fname==std::string("lpotts")){
-            return gm. template  reserveFunctions<PyLPottsFunction>(size);
-         }
-         else if(fname==std::string("lunary")){
-            return gm. template  reserveFunctions<PyLUnaryFunction>(size);
-         }
          else{
             throw opengm::RuntimeError(fname + std::string(" is an unknown function type name"));
          }
@@ -1461,8 +1454,7 @@ void export_gm() {
    typedef opengm::SquaredDifferenceFunction             <ValueType,IndexType,LabelType> PySquaredDifferenceFunction;
    typedef opengm::TruncatedSquaredDifferenceFunction    <ValueType,IndexType,LabelType> PyTruncatedSquaredDifferenceFunction;
    typedef opengm::SparseFunction                        <ValueType,IndexType,LabelType> PySparseFunction; 
-   typedef opengm::functions::learnable::LPotts          <ValueType,IndexType,LabelType> PyLPottsFunction;
-   typedef opengm::functions::learnable::LUnary          <ValueType,IndexType,LabelType> PyLUnaryFunction;
+
 
    typedef typename PyGm::FunctionIdentifier PyFid;
    typedef typename PyGm::FactorType PyFactor;
@@ -1841,8 +1833,7 @@ void export_gm() {
    .def("_addFunctions_vector",&pygm::addFunctionsGenericVectorPy<PyGm,PyTruncatedSquaredDifferenceFunction>,return_value_policy<manage_new_object>(),args("functions"),"todo")
    .def("_addFunctions_vector",&pygm::addFunctionsGenericVectorPy<PyGm,PySparseFunction>,return_value_policy<manage_new_object>(),args("functions"),"todo")
 
-   .def("_addFunction",&pygm::addFunctionGenericPy<PyGm,PyLUnaryFunction>,args("function"))
-   .def("_addFunction",&pygm::addFunctionGenericPy<PyGm,PyLPottsFunction>,args("function"))
+
    .def("_addFunction",&pygm::addFunctionGenericPy<PyGm,PyPottsFunction>,args("function"))
    .def("_addFunction",&pygm::addFunctionGenericPy<PyGm,PyPottsNFunction>,args("function"))
    .def("_addFunction",&pygm::addFunctionGenericPy<PyGm,PyPottsGFunction>,args("function"))
diff --git a/src/unittest/CMakeLists.txt b/src/unittest/CMakeLists.txt
index 27ac355..5857291 100644
--- a/src/unittest/CMakeLists.txt
+++ b/src/unittest/CMakeLists.txt
@@ -7,8 +7,6 @@ if(BUILD_TESTING)
    add_test(test-partitions ${CMAKE_CURRENT_BINARY_DIR}/test-partitions)
 
 
-   add_executable(test-gm-learning-functions test_gm_learning_functions.cxx ${headers})
-   add_test(test-gm-learning-functions ${CMAKE_CURRENT_BINARY_DIR}/test-gm-learning-functions)
 
 
    add_executable(test-graphicalmodelmanipulator test_graphicalmodelmanipulator.cxx ${headers})
@@ -31,8 +29,6 @@ if(BUILD_TESTING)
    add_executable(test-functions test_functions.cxx ${headers})
    add_test(test-functions ${CMAKE_CURRENT_BINARY_DIR}/test-functions) 
 
-   add_executable(test-learnable-functions test_learnable_functions.cxx ${headers})
-   add_test(test-learnable-functions ${CMAKE_CURRENT_BINARY_DIR}/test-learnable-functions)
 
    add_executable(test-factor test_factor.cxx ${headers})
    add_test(test-factor ${CMAKE_CURRENT_BINARY_DIR}/test-factor)
diff --git a/src/unittest/test_learnable_functions.cxx b/src/unittest/test_learnable_functions.cxx
deleted file mode 100644
index 012f752..0000000
--- a/src/unittest/test_learnable_functions.cxx
+++ /dev/null
@@ -1,79 +0,0 @@
-#include <vector>
-
-#include "opengm/functions/learnable/lpotts.hxx" 
-#include <opengm/unittests/test.hxx>
-
-template<class T>
-struct LearnableFunctionsTest {
-  typedef size_t LabelType;
-  typedef size_t IndexType;
-  typedef T      ValueType;
-
-  void testLPotts(){
-    std::cout << " * LearnablePotts ..." << std::endl; 
-
-    std::cout  << "    - test basics ..." <<std::flush;
-    // parameter
-    const size_t numparam = 1;
-    opengm::learning::Weights<ValueType> param(numparam);
-    param.setWeight(0,5.0);
-    
-    LabelType numL = 3;
-    std::vector<size_t> pIds(1,0);
-    std::vector<ValueType> feat(1,1);
-    // function
-    opengm::functions::learnable::LPotts<ValueType,IndexType,LabelType> f(param,numL,pIds,feat);
-
-    LabelType l[] ={0,0};
-    for(l[0]=0;l[0]<numL;++l[0]){
-      for(l[1]=0;l[1]<numL;++l[1]){
-	if(l[0]==l[1]){
-	  OPENGM_TEST_EQUAL_TOLERANCE(f(l),0, 0.0001);
-	}else{
-	  OPENGM_TEST_EQUAL_TOLERANCE(f(l),5.0, 0.0001);
-	}
-      }
-    }
-    std::cout << " OK" << std::endl; 
-    std::cout  << "    - test serializations ..." <<std::flush;
-    {
-       typedef  opengm::functions::learnable::LPotts<ValueType,IndexType,LabelType> FUNCTION;
-       const size_t sizeIndices=opengm::FunctionSerialization<FUNCTION>::indexSequenceSize(f);
-       const size_t sizeValues=opengm::FunctionSerialization<FUNCTION>::valueSequenceSize(f);
-       std::vector<long long unsigned> indices(sizeIndices);
-       std::vector<T> values(sizeValues);
-      
-       opengm::FunctionSerialization<FUNCTION>::serialize(f,indices.begin(),values.begin());
-       FUNCTION f2;
-       opengm::FunctionSerialization<FUNCTION>::deserialize(indices.begin(),values.begin(),f2);
-       f2.setWeights(param);
-
-       OPENGM_TEST(f.dimension()==f2.dimension());
-       OPENGM_TEST(f.size() == f2.size());
-       std::vector<size_t> shape(f.dimension());
-       for(size_t i=0;i<f.dimension();++i) {
-          shape[i]=f.shape(i);
-          OPENGM_TEST(f.shape(i)==f2.shape(i));
-       }
-       opengm::ShapeWalker<std::vector<size_t>::const_iterator > walker(shape.begin(),f.dimension());
-       for(size_t i=0;i<f.size();++i) {
-          OPENGM_TEST(walker.coordinateTuple().size()==f.dimension());
-          OPENGM_TEST(f(walker.coordinateTuple().begin())==f2(walker.coordinateTuple().begin()) );
-          ++walker;
-       }
-    }
-    std::cout << " OK" << std::endl; 
-  }
-
-};
-
-
-int main() {
-   std::cout << "Learnable Functions test...  " << std::endl;
-   {
-      LearnableFunctionsTest<double>t;
-      t.testLPotts();
-   }
-   std::cout << "done.." << std::endl;
-   return 0;
-}

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