From 573a1c44039e5e1701dd461a4431c3da1faf1953 Mon Sep 17 00:00:00 2001 From: amosbrazzoli <43097283+amosbrazzoli@users.noreply.github.com> Date: Thu, 15 Apr 2021 19:09:43 +0200 Subject: [PATCH] Update HMM.py Fixes the following error due to trying to index with a float IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices in python 3.8 numpy 1.20.2 --- Ch16/HMM.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ch16/HMM.py b/Ch16/HMM.py index 9889d95..a3fed28 100755 --- a/Ch16/HMM.py +++ b/Ch16/HMM.py @@ -70,7 +70,7 @@ def Viterbi(pi,a,b,obs): path[T-1] = np.argmax(delta[:,T-1]) for t in range(T-2,-1,-1): - path[t] = phi[path[t+1],t+1] + path[t] = phi[int(path[t+1]),t+1] return path,delta, phi