⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_tie.py

📁 General Hidden Markov Model Library 一个通用的隐马尔科夫模型的C代码库
💻 PY
字号:
##################################################################################       This file is part of the General Hidden Markov Model Library,#       GHMM version 0.8_beta1, see http://ghmm.org##       file:    test_tie.py#       authors: Benjamin Georgi##       Copyright (C) 1998-2004 Alexander Schliep#       Copyright (C) 1998-2001 ZAIK/ZPR, Universitaet zu Koeln#       Copyright (C) 2002-2004 Max-Planck-Institut fuer Molekulare Genetik,#                               Berlin##       Contact: schliep@ghmm.org##       This library is free software; you can redistribute it and/or#       modify it under the terms of the GNU Library General Public#       License as published by the Free Software Foundation; either#       version 2 of the License, or (at your option) any later version.##       This library is distributed in the hope that it will be useful,#       but WITHOUT ANY WARRANTY; without even the implied warranty of#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU#       Library General Public License for more details.##       You should have received a copy of the GNU Library General Public#       License along with this library; if not, write to the Free#       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA###       This file is version $Revision: 1815 $#                       from $Date: 2007-01-25 15:24:21 +0100 (Thu, 25 Jan 2007) $#             last change by $Author: cic99 $.#################################################################################from ghmm import *sigma = IntegerRange(0,4)m = HMMFromMatrices(sigma,DiscreteDistribution(sigma),                       [[0.5,0.5,0.0,0.0],[0.0,0.0,1.0,0.0],[0.6,0.0,0.0,0.4],[1.0,0.0,0.0,0.0]],                       [[1.0,0.0,0.0,0.0],[0.0,1.0,0.0,0.0],[0.0,0.0,1.0,0.0],[0.0,0.0,0.0,1.0]],                       [1.0,0.0,0.0,0.0] )#t2 = (0,-1,0,-1)#m.setTieGroups(t2)m2 = HMMFromMatrices(sigma,DiscreteDistribution(sigma),                       [[0.3,0.3,0.4],[0.6,0.1,0.3],[0.3,0.3,0.4]],                       [[0.3,0.2,0.3,0.2],[0.1,0.2,0.4,0.3],[0.0,0.0,0.0,0.0] ], # [0.25,0.25,0.25,0.25]                       [1.0,0,0])                                              t = (0,-1,0)m2.setTieGroups(t)#m2.updateTieGroups()#print m2#train = m2.sample(50,1000)#print m2#m2.baumWelch(train,3,10)print m2m2.updateTieGroups()print "after update"print m2#m2.baumWelch(train,3,10)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -