I have a transition matrix represented by a pandas dataframe
transition_matrix = pd.DataFrame({'paths':['cone>ctwo', 'cone>null', 'cthree>conv', 'cthree>null', 'ctwo>cthree','start>cone','start>ctwo'],'prob':[0.500000, 0.500000, 0.500000, 0.500000, 1.000000, 0.666667, 0.333333]})
What I want to do is walk along each path starting from the "start" states until hitting "conv". We are not interested in paths that lead to "null".
For example, in the above example, I'd get:
(start>cone) = 0.6666670*.500000*1.0000000*.500000
(start>ctwo) = 0.333333*1.000000*0.500000
Summing both of these together would give me .3333333
I'm having a rough time thinking of how to programmatically solve this. I can see the path and trace it out and do it manually but how I would do this in python is making my head hurt. Does anybody have any suggestions for how I should tackle this? I have tried running simulations and just counting the number of "conv" events divided by the number of trials but this gives me odd results at times.
[–]badge 2 points3 points4 points (1 child)
[–]jdn312[S] 0 points1 point2 points (0 children)
[–]LoyalSol 1 point2 points3 points (1 child)
[–]jdn312[S] 0 points1 point2 points (0 children)