Skip to content

Add numerical stability to HMM weight calculation#53

Closed
adrianodemarino wants to merge 2 commits intomasterfrom
hotfix/numerical_stability_hmm
Closed

Add numerical stability to HMM weight calculation#53
adrianodemarino wants to merge 2 commits intomasterfrom
hotfix/numerical_stability_hmm

Conversation

@adrianodemarino
Copy link
Collaborator

Add numerical stability to HMM weight calculation, prevent division by zero and round to 8 decimals for consistent results, avoiding micro-variations in high-throughput environments like AWS Fargate in prod-us

…y zero and round to 8 decimals for consistent results, avoiding micro-variations in high-throughput environments like AWS Fargate in prod-us
@adrianodemarino adrianodemarino requested a review from a team August 25, 2025 16:33

weights = weights / weights.sum(axis=1, keepdims=True)
weight_sums = weights.sum(axis=1, keepdims=True)
weight_sums = np.where(weight_sums == 0, 1.0, weight_sums)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sum cannot be 0

@adrianodemarino adrianodemarino deleted the hotfix/numerical_stability_hmm branch August 26, 2025 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants