锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久久久久久爱,激情不卡一区二区三区视频在线,丁香花高清电影在线观看完整版http://www.aygfsteel.com/nianzai/category/52552.htmlzh-cnTue, 11 Sep 2012 19:46:09 GMTTue, 11 Sep 2012 19:46:09 GMT60鏈哄櫒瀛︿範(fàn):Viterbi(緇寸壒姣?瀹炵幇紼嬪簭http://www.aygfsteel.com/nianzai/archive/2012/09/07/387259.htmlnianzainianzaiFri, 07 Sep 2012 08:43:00 GMThttp://www.aygfsteel.com/nianzai/archive/2012/09/07/387259.htmlhttp://www.aygfsteel.com/nianzai/comments/387259.htmlhttp://www.aygfsteel.com/nianzai/archive/2012/09/07/387259.html#Feedback0http://www.aygfsteel.com/nianzai/comments/commentRss/387259.htmlhttp://www.aygfsteel.com/nianzai/services/trackbacks/387259.htmlhttp://en.wikipedia.org/wiki/Viterbi_algorithm錛夛紝浣嗘槸3涓瀵熷簭鍒椾細(xì)鏍囨敞鍑?涓姸鎬佸簭鍒椼?br />涓嬮潰鏈漢鍐欑殑榪欎釜Viterbi(緇寸壒姣?瀹炵幇紼嬪簭灝辨病榪欎釜闂錛?涓瀵熷簭鍒楀氨鍙爣娉ㄥ嚭3涓姸鎬佸簭鍒椼?div style="padding: 4px 5px 4px 4px; border: 1px solid rgb(204, 204, 204); width: 98%; font-size: 13px; word-break: break-all; background-color: rgb(238, 238, 238);">public class Viterbi
{
    
public static void main(String[] args)
    
{
        String[] states 
= {"Rainy""Sunny"};
        String[] observations 
= {"walk""shop""clean"};
        
double[] start_probability = {0.60.4};
        
double[][] transition_probability = {{0.70.3}{0.40.6}};
        
double[][] emission_probability = {{0.10.40.5}{0.60.30.1}};
        forward_viterbi(observations,states,start_probability,transition_probability,emission_probability);
    }

    
    
public static void  forward_viterbi(String[] observations, String[] states,double[] start_probability, double[][] transition_probability, double[][] emission_probability)
    
{
        
int[][] path=new int[observations.length][states.length];
        
double[][] r=new double[observations.length][states.length];
        
for(int j=0;j<states.length;j++)
        
{
            r[
0][j]=start_probability[j]*emission_probability[j][0];
            path[
0][j]=0;
        }

        
        
for(int t=1;t<observations.length;t++)
        
{
            
for(int i=0;i<states.length;i++)
            
{
                
double tmp=0;int m=0;
                
for(int j=0;j<states.length;j++)
                
{
                    
double tem=r[t-1][j]*transition_probability[j][i]*emission_probability[i][t];
                    
if(tem>tmp)
                    
{
                        tmp
=tem;
                        m
=j;
                    }

                }

                r[t][i]
=tmp;
                path[t][i]
=m;
            }

        }

        
        
double p=0;int m=0;
        
for(int i=0;i<r[0].length;i++)
        
{
            
if(r[r.length-1][i]>p)
            
{
                p
=r[r.length-1][i];
                m
=i;
            }

        }

        
        System.out.println(
"p="+p);
        
        
int[] trace=new int[observations.length];
        trace[observations.length
-1]=m;
        
for(int t=observations.length-1;t>0;t--)
        
{
            trace[t
-1]=path[t][m];
            m
=path[t][m];
        }

        
        
for(int i=0;i<trace.length;i++)
            System.out.println(states[trace[i]]);
    }

}
銆?br />


nianzai 2012-09-07 16:43 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 凌海市| 闽清县| 禄丰县| 营口市| 巴林左旗| 游戏| 玉山县| 富平县| 阿巴嘎旗| 池州市| 汉寿县| 玉龙| 大宁县| 望奎县| 当阳市| 岳普湖县| 冷水江市| 通海县| 防城港市| 鹿泉市| 元朗区| 秦安县| 贵德县| 和田县| 周口市| 土默特右旗| 广宗县| 紫金县| 拜泉县| 乌鲁木齐市| 望谟县| 微博| 漳浦县| 扎囊县| 樟树市| 韶关市| 屏东市| 滁州市| 长葛市| 西乡县| 桃园县|