commit e29420288e620e5e817fb209fed6e5cecf844715
parent 25f1d52662c8597ea73276f8ebc53bf6b2f66663
Author: Stefan Koch <taikano@lavabit.com>
Date: Sat, 22 Jun 2013 12:42:05 +0200
make sure emission probs sum up to one
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/models.py b/models.py
@@ -48,13 +48,13 @@ def emission_matrix(gesture):
for geste in gestes:
if geste == UP:
- B[geste] = [0.5, 0.05, 0.1, 0.1, 0.2, 0.2, 0.1, 0.1]
+ B[geste] = [0.37, 0.04, 0.07, 0.07, 0.155, 0.155, 0.07, 0.07]
elif geste == DOWN:
- B[geste] = [0.05, 0.5, 0.1, 0.1, 0.1, 0.1, 0.2, 0.2]
+ B[geste] = [0.04, 0.37, 0.07, 0.07, 0.07, 0.07, 0.155, 0.155]
elif geste == LEFT:
- B[geste] = [0.1, 0.1, 0.5, 0.05, 0.1, 0.2, 0.1, 0.2]
+ B[geste] = [0.07, 0.07, 0.37, 0.04, 0.07, 0.155, 0.07, 0.155]
else:
- B[geste] = [0.1, 0.1, 0.05, 0.5, 0.2, 0.1, 0.2, 0.1]
+ B[geste] = [0.07, 0.07, 0.04, 0.37, 0.155, 0.07, 0.155, 0.07]
print(B)
return B
@@ -74,7 +74,7 @@ for gesture in gestures:
pi = initial_vector(gesture[0])
m = ghmm.HMMFromMatrices(sigma, ghmm.DiscreteDistribution(sigma), A, B, pi)
-
+ print(m)
if os.path.isfile(''.join(('models/', str(i), '.train'))):
with open(''.join(('models/', str(i), '.train'))) as f:
training_data[i] = simplejson.load(f)