/ghmm-0.7.0/ghmm/sfoba.h
C Header | 104 lines | 15 code | 10 blank | 79 comment | 0 complexity | 5ae2fcc97c351f5f5c687f1f585de69b MD5 | raw file
Possible License(s): GPL-2.0
1/******************************************************************************* 2* 3* This file is part of the General Hidden Markov Model Library, 4* GHMM version __VERSION__, see http://ghmm.org 5* 6* Filename: ghmm/ghmm/sfoba.h 7* Authors: Bernhard Knab, Benjamin Georgi 8* 9* Copyright (C) 1998-2004 Alexander Schliep 10* Copyright (C) 1998-2001 ZAIK/ZPR, Universitaet zu Koeln 11* Copyright (C) 2002-2004 Max-Planck-Institut fuer Molekulare Genetik, 12* Berlin 13* 14* Contact: schliep@ghmm.org 15* 16* This library is free software; you can redistribute it and/or 17* modify it under the terms of the GNU Library General Public 18* License as published by the Free Software Foundation; either 19* version 2 of the License, or (at your option) any later version. 20* 21* This library is distributed in the hope that it will be useful, 22* but WITHOUT ANY WARRANTY; without even the implied warranty of 23* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24* Library General Public License for more details. 25* 26* You should have received a copy of the GNU Library General Public 27* License along with this library; if not, write to the Free 28* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 29* 30* 31* This file is version $Revision: 1191 $ 32* from $Date: 2005-06-21 11:56:12 +0200 (Tue, 21 Jun 2005) $ 33* last change by $Author: cic99 $. 34* 35*******************************************************************************/ 36#ifndef SFOBA_H 37#define SFOBA_H 38 39#include <ghmm/smodel.h> 40 41#ifdef __cplusplus 42extern "C" { 43#endif 44 45/**@name SHMM Forward-Backward-Algorithm */ 46/*@{ (Doc++-Group: sfoba) */ 47 48/** Forward-Backward-Algorithm for multiple double 49 sequences with scaling. 50 For reference see: 51 Rabiner, L.R.: "`A Tutorial on Hidden {Markov} Models and Selected 52 Applications in Speech Recognition"', Proceedings of the IEEE, 53 77, no 2, 1989, pp 257--285 54*/ 55 56 57/** Forward-Algorithm. 58 Calculates alpha[t][i], scaling factors scale[t] and log( P(O|lambda) ) for 59 a given double sequence and a given model. 60 @param smo model 61 @param O sequence 62 @param T length of sequence 63 @param alpha alpha[t][i] 64 @param scale scale factors 65 @param log_p log likelihood log( P(O|lambda) ) 66 @return 0 for success, -1 for error 67 */ 68 int sfoba_forward (smodel * smo, double *O, int T, double ***b, 69 double **alpha, double *scale, double *log_p); 70 71/** 72 Backward-Algorithm. 73 Calculates beta[t][i] given a double sequence and a model. Scale factors 74 given as parameter (come from sfoba\_forward). 75 @param smo model 76 @param O sequence 77 @param T length of sequence 78 @param b matrix with precalculated output probabilities. May be NULL 79 @param beta beta[t][i] 80 @param scale scale factors 81 @return 0 for success, -1 for error 82 */ 83 int sfoba_backward (smodel * smo, double *O, int T, double ***b, 84 double **beta, const double *scale); 85 86/** 87 Calculation of log( P(O|lambda) ). 88 Done by calling sfoba\_forward. Use this function if only the 89 log likelihood and not alpha[t][i] is needed, alpha matrix is allocated with 90 stat_matrix_d_alloc 91 @param smo model 92 @param O sequence 93 @param T length of sequence 94 @param log_p log likelihood log( P(O|lambda) ) 95 @return 0 for success, -1 for error 96 */ 97 int sfoba_logp (smodel * smo, double *O, int T, double *log_p); 98 99 100#ifdef __cplusplus 101} 102#endif 103/*@} (Doc++-Group: sfoba) */ 104#endif