Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73485

Understanding Python Code[Forward_Backward_Wikipedia]

Newsgroups comp.lang.python
Date 2014-06-21 15:05 -0700
References (4 earlier) <f1d47c99-b309-4ecd-8a6b-1f3b25d83370@googlegroups.com> <mailman.11152.1403187031.18130.python-list@python.org> <ddd0c8c7-fb10-4ab3-8a49-3cf321777019@googlegroups.com> <2a585d13-cb45-4cf1-b73f-a60c93194343@googlegroups.com> <mailman.11157.1403205374.18130.python-list@python.org>
Message-ID <58a11434-4cd7-46e9-a821-60a75c22cdf7@googlegroups.com> (permalink)
Subject Understanding Python Code[Forward_Backward_Wikipedia]
From subhabangalore@gmail.com

Show all headers | View raw


On Friday, June 20, 2014 12:37:01 AM UTC+5:30, Ian wrote:
> On Thu, Jun 19, 2014 at 12:44 PM,   wrote:
> 
> > Dear Group,
> 
> > Generally most of the issues are tackled here, but as I am trying to cross check my understanding I found another question,
> 
> >
> 
> > f_curr[st] = e[st][x_i] * prev_f_sum
> 
> >
> 
> > Here, if I give one print command and see the results,
> 
> > print "$$2",f_curr
> 
> >
> 
> > It is showing an iterative update like,
> 
> > $$2 {'Healthy': 0.3},
> 
> > $$2 {'Healthy': 0.3, 'Fever': 0.04000000000000001}
> 
> >
> 
> > I was trying to ask how the size is being updated, from 1 to 2 back to 1 again 2... is it for any loop then which one, I tried to change but not being able
> 
> > to if any one of the esteemed members may kindly help me.
> 
> 
> 
> That statement is inside the for loop that builds the f_curr dict. One
> 
> state gets calculated on each iteration. The first time it prints, one
> 
> state has been added. The second time it prints, two states have been
> 
> added. You only have two states, so at that point the loop is done.
> 
> The next time it prints, it's on the next iteration of the outer (i,
> 
> x_i) loop and it's building a new f_curr dict. So then you see it
> 
> adding one state and then the second state to the new dict. And so on
> 
> and so forth until the outer loop completes.

Dear Group,

Thank you for the kind help. I could solve other portions of the code easily.
As this algorithm is an important algorithm so is its Wikipedia note, so I changed subject line bit, in case future users try to solve any questions, they may get the helps.
Thank you again especially to Ian. 

Regards,
Subhabrata Banerjee.
S

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Understanding Python Code subhabangalore@gmail.com - 2014-06-18 09:36 -0700
  Re: Understanding Python Code Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-18 13:15 -0600
    Re: Understanding Python Code subhabangalore@gmail.com - 2014-06-18 22:50 -0700
      Re: Understanding Python Code Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-19 01:00 -0600
        Re: Understanding Python Code subhabangalore@gmail.com - 2014-06-19 02:48 -0700
          Re: Understanding Python Code Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-19 08:09 -0600
            Re: Understanding Python Code subhabangalore@gmail.com - 2014-06-19 07:27 -0700
              Re: Understanding Python Code subhabangalore@gmail.com - 2014-06-19 11:44 -0700
                Re: Understanding Python Code Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-19 13:07 -0600
                Understanding Python Code[Forward_Backward_Wikipedia] subhabangalore@gmail.com - 2014-06-21 15:05 -0700

csiph-web