Skip to content

Instantly share code, notes, and snippets.

@tabris2012
Created May 24, 2012 03:06
Show Gist options
  • Save tabris2012/2779209 to your computer and use it in GitHub Desktop.
Save tabris2012/2779209 to your computer and use it in GitHub Desktop.
for ($i =1; $i < @$lineList; $i++) {
if (${$trans[$state[$i -1]]}[$state[$i]] <0.4) { #遷移確率が低かったら修正
if ($pk[$state[$i -1]] <0.4) { #遷移前の出現確率も低かったら修正
for ($j =0; $j < @{$vector[$i]}; $j++) {
if ((${$vector[$i]}[$j]) && ($j != $stateAttr[$state[$i -1]] -1)) {
push @estAttr, $j +1;
last;
}
}
if ($j == @{$vector[$i]}) {
push @estAttr, $stateAttr[$state[$i -1]];
}
}
else { #遷移させなかった場合の状態からの属性を採用
push @estAttr, $stateAttr[$state[$i -1]];
}
}
elsif ($pk[$state[$i]] <0.4) { #出現確率が低かったら修正
for ($j =0; $j < @{$vector[$i]}; $j++) {
if ((${$vector[$i]}[$j]) && ($j != $stateAttr[$state[$i]] -1)) {
push @estAttr, $j +1;
last;
}
}
if ($j == @{$vector[$i]}) {
push @estAttr, $stateAttr[$state[$i]];
}
}
else {
push @estAttr, $stateAttr[$state[$i]];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment