Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8776715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:07:18+00:00 2026-06-13T19:07:18+00:00

I have the transition matrix, emission matrix and starting state for a hidden Markov

  • 0

I have the transition matrix, emission matrix and starting state for a hidden Markov model. I want to generate a sequence of observations (emissions). However, I’m stuck on one thing.

I understand how to choose among two states (or emissions). If Event A probability x, then Event B (or, really not-A) occurs with probability 1-x. To generate a sequence of A’s and B’s, with a random number, rand, you do the following.

 for iteration in iterations:
      observation[iteration] <- A if rand < x else B

I don’t understand how to extend this to more than two variables. For example, if three events occur such that Event A occurs with probability x1, Event B with x2 and Event C with 1-(x1+x2), then how do I extend the above pseudocode?

I didn’t find the answer Googling. In fact I get the impression that I’m missing a basic fact that many of the notes online assume. :-/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:07:19+00:00Added an answer on June 13, 2026 at 7:07 pm

    One way would be

     x<-rand()
      if x < x1 observation is A
      else if x < x1 + x2 observation is B
      else observation is C
    

    Of course if you have a large number of alternatives it might be better to build a cumulative probability table (holding x1, x1+x2, x1+x2+x3 …) and then do a binary search in that table given the random number. If you are willing to do more preprocessing, there is an even more efficient way, see here for example

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a code in Python to create a transition probability matrix from
Imagine I have a function that gives the transition probability of going from state
Taken I have some transition operations where certain numbers of my matrix (M) are
I have a case where I need a method to rotate a model matrix
I have a transition looking like this: <?xml version=1.0 encoding=UTF-8?> <transition xmlns:android=http://schemas.android.com/apk/res/android > <item
I have to transition the CornerRadius property of a Border from value 0,0,0,0 to
I'd like to have a transition to text-transform:uppercase when I mouse-over a link. I've
I have an app that uses a transition file to flip from page to
I have a slider that has a fade-in and fade-out transition. It basically cycles
I have been following mozilla developer network's docs and created a transition for my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.