Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predecessor patch #15

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pytrack/matching/mpmatching.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ def viterbi_search(G, trellis, start="start", target="target", beta=mpmatching_u
except Exception as error:
print(error)

predecessor = mpmatching_utils.get_predecessor("target", predecessor)
# get_predecessor and viterbi_search should seperate. Decoupling!

#predecessor = mpmatching_utils.get_predecessor("target", predecessor)

return joint_prob[target], predecessor
12 changes: 12 additions & 0 deletions pytrack/matching/mpmatching_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,22 @@ def get_predecessor(target, predecessor):
pred_elab: dict
Dictionary containing the predecessors of the best nodes of a decoded Trellis DAG.
"""

"""
2023/02/03

the key "target" may not be in the predecessor
check if key in the predecessor or not before the "get" occurs
"""

pred_elab = {}
if target not in predecessor:
return {}
pred = predecessor[target]
while pred != "start":
pred_elab[target.split("_")[0]] = pred
target = pred
if target not in predecessor:
return {}
pred = predecessor[target]
return pred_elab