[opengm] 42/386: learnable functions in python seems to work

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Aug 31 08:35:02 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 1e49cc8263da902f4b2c771687cbc1b423483126
Author: DerThorsten <thorsten.beier at iwr.uni-heidelberg.de>
Date:   Mon Dec 15 14:59:48 2014 +0100

    learnable functions in python seems to work
---
 fubar/python_stuff.py | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/fubar/python_stuff.py b/fubar/python_stuff.py
new file mode 100644
index 0000000..4d7525b
--- /dev/null
+++ b/fubar/python_stuff.py
@@ -0,0 +1,40 @@
+import opengm
+import numpy
+
+
+numLabels = 4
+numVar = 6
+
+
+# make the gm
+space = numpy.ones(numVar)*4
+gm = opengm.gm(space)
+
+
+
+
+weights = opengm.Weights(4)
+for i in range(4):
+    weights[i] = 1.0
+
+
+
+
+
+features = numpy.array([1.0, 5.0]).astype(opengm.value_type)
+weightIds = numpy.array([0,1]).astype(opengm.index_type)
+
+f = opengm.LPottsFunction(weights=weights, numberOfLabels=numLabels, 
+                          weightIds=weightIds, features=features)
+
+
+
+fid = gm.addFunction(f)
+gm.addFactor(fid, [0,1])
+
+print numpy.array(gm[0])
+weights[0] = 0.5
+
+print numpy.array(gm[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