[Depmix-commits] r93 - trunk/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 20 12:32:06 CET 2008


Author: ingmarvisser
Date: 2008-03-20 12:32:06 +0100 (Thu, 20 Mar 2008)
New Revision: 93

Modified:
   trunk/R/viterbi.R
Log:
Changed hmm into object etc, not working unfortunately ...

Modified: trunk/R/viterbi.R
===================================================================
--- trunk/R/viterbi.R	2008-03-20 11:05:16 UTC (rev 92)
+++ trunk/R/viterbi.R	2008-03-20 11:32:06 UTC (rev 93)
@@ -1,19 +1,19 @@
-viterbi <- function(hmm) {
+viterbi <- function(object) {
     # returns the most likely state sequence
-    nt <- sum(hmm at ntimes)
-    lt <- length(hmm at ntimes)
-		et <- cumsum(hmm at ntimes)
+    nt <- sum(object at ntimes)
+    lt <- length(object at ntimes)
+		et <- cumsum(object at ntimes)
 		bt <- c(1,et[-lt]+1)
 		
-    ns <- hmm at nstates
+    ns <- object at nstates
     
     delta <- psi <- matrix(nrow=nt,ncol=ns)
     state <- vector(length=nt)
     
-    prior <- exp(logDens(hmm at initModel))
+    prior <- object at init
     
-    A <- hmm at trans
-    B <- apply(hmm at logdens,c(1,3),sum)
+    A <- object at trDens
+    B <- apply(log(object at dens),c(1,3),sum)
     
     for(case in 1:lt) {
     # initialization



More information about the depmix-commits mailing list