How to create 3 dimension array from 1 & 2 dimension array
Tawee Laoitichote
astpspd at pea.or.th
Fri Apr 27 02:13:37 EDT 2001
Dear John,
The 2-d array is to keep the state transition probabilities table whilst
the 1-d array is to keep each transition step. Each step is calculated
then keep in the state transition table then I get the 3 dimension
array. In my case, the 2-d array has a shape of 4 by 4 with 3-step
transition.
Say :
py> print P1
[[ 0.0803014 0.18393972 0.36787944 0.36787944]
[ 0.63212056 0.36787944 0. 0. ]
[ 0.26424112 0.36787944 0.36787944 0. ]
[ 0.0803014 0.18393972 0.36787944 0.36787944]]
py> print P1.shape
(4, 4)
py> print P2
[[ 0.2494705 0.28544118 0.3002118 0.16487652]
[ 0.28330432 0.25160736 0.23254416 0.23254416]
[ 0.35097196 0.319275 0.23254416 0.09720887]
[ 0.2494705 0.28544118 0.3002118 0.16487652]]
py> print P3
[[ 0.29303419 0.29166457 0.2628715 0.15242975]
[ 0.26191727 0.27299442 0.27531827 0.18977005]
[ 0.29925757 0.28544118 0.25042473 0.16487652]
[ 0.29303419 0.29166457 0.2628715 0.15242975]]
Tawee
More information about the Python-list
mailing list