hparm.mdl_segmax=1; hparm.kbonus = 0; hparm.do_gang = 1; iplot=1; num_iter=10; use_viterbi = 0; [hparm,lptot]=mrhmm_iterate(hparm,Z, J,Icls,ntot,num_iter,use_viterbi,iplot,X);Note that if Icls is supplied, the MR-HMM will implement forced training by applying a positive bias to segments that have a non-zero class label. The bias is equal to hparm.align_bias. The number of iterations is specified by num_iter. Flag use_viterbi (1 or 0) specifies if the Viterbi algorithm or the forward procedure are used to determine the path through the proxy HMM trellis. If the Viterbi algorithm is used, it is faster, and produces a single path (segmentation) which can be visualized if iplot=1. If forward procedure is used, one can see the probability is shared between all the possible paths, and is clearly closer to optimal, but takes longer. The updated parameters are output in hparm and lptot is the total log-likelihood (per event). If you just want to determine lptot, set num_iter=0. The parameters hparm.mdl_segmax and hparm.kbonus influence the segmentation and are explained in software/mrhmm_initialize.m.
The parameter hparm.do_gang is set to 1 (default) to use ganging. To understand ganging, remember that the MR-HMM , through the proxy trellis probabilities gamma (See Sections 14.2.4 and 14.4.1) effectively assigns each base segment to one or another partition. If we sum up all the partition probabilities of a given signal class (very bottom of Figure 14.1), we can assign each base segment to a subclass. Ganging decides if we use partition or signal class probabilities when updating the partition PDFs. In other words, if it is important that a PDF gets updated only using data segments assigned to that partition, use hparm.do_gang=0. But, if it is only important that the signal class is correct, use hparm.do_gang=1. Using hparm.do_gang=1 is usually much better because it effectively increases the amount of data used to update each PDF.