亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

python - Find Markov chain state transition probability matrix
習(xí)慣沉默
習(xí)慣沉默 2017-05-18 10:57:34
0
1
1780

A time series is as follows:

0.19
0.19
0.13
0.01
-0.03
-0.03
0.03
0.09
-0.13
-0.13
0.05
-0.03
0.03
0.09
-0.07
0.11
0.05
0.01
-0.05
-0.01
0.07
0.01
-0.15
-0.01
······

This time series has a total of 4032 values. The value space of these values ??has 115 ways a=[-0.49,-0.47,-0.45······1.75,1.77,1.79]. Now I want to find it out. I wrote a matlab program for this 115*115 state transition probability matrix, but there was a problem with the calculation. I would like to ask the experts what to do if I use Python. As a newbie, I only know how to use if statements to implement it, but In this case, we have to write 115 if statements. How can we do it more concisely? Thank you everyone

習(xí)慣沉默
習(xí)慣沉默

reply all(1)
漂亮男人

I’m not sure how the Markov chain is calculated. I guess it’s a state transfer. Let’s see if the following is useful.

a = [1,2,3,0,0,0,3,3,2,3,3,2,3,2,1,2,3]


l = 4
N = [[0] * l for i in range(l)]

amount = 0
for i in data:
    print i
    amount += 1
    N[i[0]][i[1]] += 1

print amount
for i in range(l):
    for j in range(l):
        N[i][j] /= float(amount)
print N
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template