Created
May 10, 2012 03:08
-
-
Save tabris2012/2650789 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for ($i =0; $i < $K; $i++) { #遷移確率を求める | |
for ($j =0; $j < $K; $j++) { | |
$t0 =0; | |
$t1 =0; | |
for ($u =0; $u < @state -1; $u++) { #個数を数える | |
if ($state[$u] == $i) { | |
$t0++; | |
if ($state[$u +1] == $j) { | |
$t1++; | |
} | |
} | |
} | |
#遷移確率を計算 | |
push @{$trans[$i]}, (1- $alpha) * $t1 / $t0 + $alpha / $K; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment