testParamDurHMM

所属分类:Windows编程
开发工具:C/C++
文件大小:86KB
下载次数:11
上传日期:2009-07-13 11:10:50
上 传 者baokh
说明:  Efficient Hidden Semi-Markov Model Inference for Structured Video Sequences

文件列表:
testParamDurHMM (0, 2009-07-13)
testParamDurHMM\abbrev.hh (2562, 2006-05-01)
testParamDurHMM\arrayMacros.cc (12097, 2006-05-02)
testParamDurHMM\arrayMacros.hh (23365, 2006-05-02)
testParamDurHMM\basicIO.cc (14724, 2006-05-02)
testParamDurHMM\basicIO.hh (5660, 2006-05-01)
testParamDurHMM\findCrossoverLogProbDists.cc (20387, 2006-05-22)
testParamDurHMM\findCrossoverLogProbDists.hh (4059, 2006-05-01)
testParamDurHMM\gaussianDefs.X (583, 2006-05-22)
testParamDurHMM\genMatrixRoutines.cc (15557, 2006-05-02)
testParamDurHMM\genMatrixRoutines.hh (4675, 2006-05-01)
testParamDurHMM\genRandomVarDurationHMM.cc (8186, 2006-05-22)
testParamDurHMM\genRandomVarDurationHMM.hh (1546, 2006-05-22)
testParamDurHMM\machineMacros.hh (237, 2006-05-02)
testParamDurHMM\machineSpecifics.hh (1181, 2006-05-02)
testParamDurHMM\macros.hh (2716, 2006-05-01)
testParamDurHMM\makefile (1537, 2006-05-22)
testParamDurHMM\memtrack.cc (4470, 2006-05-02)
testParamDurHMM\memtrack.hh (5161, 2006-05-22)
testParamDurHMM\modifiedGammaDefs.X (580, 2006-05-22)
testParamDurHMM\numericConversions.hh (5803, 2006-05-02)
testParamDurHMM\pairExts.cc (1308, 2006-05-02)
testParamDurHMM\pairExts.hh (12299, 2006-05-02)
testParamDurHMM\parameterisedDurationHMM.cc (29899, 2006-05-22)
testParamDurHMM\parameterisedDurationHMM.hh (4261, 2006-05-22)
testParamDurHMM\primDebugging.cc (15637, 2006-05-02)
testParamDurHMM\primDebugging.hh (4032, 2006-05-02)
testParamDurHMM\programName.cc (152, 2006-05-01)
testParamDurHMM\programName.hh (316, 2006-05-02)
testParamDurHMM\randomRoutines.cc (20735, 2006-05-22)
testParamDurHMM\randomRoutines.hh (9313, 2006-05-22)
testParamDurHMM\rangeRep1D.cc (104, 2006-05-01)
testParamDurHMM\rangeRep1D.hh (7358, 2006-05-01)
testParamDurHMM\simpleReferenceCounting.hh (982, 2006-05-01)
testParamDurHMM\stlAllocator.cc (2369, 2006-05-02)
testParamDurHMM\stlAllocator.hh (1389, 2006-05-01)
testParamDurHMM\stlMacros.hh (1155, 2006-05-01)
testParamDurHMM\testParamDurHMM.cc (16683, 2006-05-22)
testParamDurHMM\typedefs.cc (42, 2006-05-01)
... ...

/********************************************************************************* *README *======= * *Contained in this directory is compilable source code for a simple *tester module for experimenting with the Hidden Semi-Markov Model. *From a set of "meta-parameters" it generates a model instance and then *produces a random instance of the output of this model. * *This code is NOT directly supported: see the course details for further *information. Likewise, these instructions assume familiarity with the underlying *model described in the course and merely describe the particular program *instance. * *The basic model is of 4 states each assigned a 1-D real number as it's "state value". *The test data generation is hardwired to 4 states just for ease of visualisation. *At each timestep the current state produces a 1-D real number as it's "noisy observation" *which is comprised from the value plus "Gaussian noise scaled by a per-state *scaling factor". Each state also has a parametric distribution of how long it stays in that *state and a transition table giving the probabilities of transitioning to each other state *at the point at which it does leave the current state. The decoding algorithm is given *the true values of the "state value", per-class noise, duration distribution parameters *and transition tables along with the noisy observations and finds the most likely *sequence of states to produce those observations. The very simple 1-D case has *been chosen simply for ease of visualisation. * *The aim is to enable exploration of the effects of various meta-parameters on the kind of *model output produced and how well the decoding (which is the *__most likely decoding__ given the model instance parameters) matches *the actual sequence of states produces by that model. The source code *and makefile have been tested on Linux and should work on any Unix *derivative. It is very unlikely to work "out-of-the-box" on Windows. * *Unpack the tar-ball into a suitable directory and then build using * make -f makefile *This should produce an executable called testParamDurHMMD in the *current directory. (You might possibly have to alter one or two of the *defines for things like libraries in the makefile.) * *NOTE: to be able to compare output from different runs it is recommended NOT to *run the program in the build directory. * *This program takes two arguments * * testParamDurHMMD * *a problem definition file and an overiew-output file name . If *out is - then standard output is used. The problem definition file gives *the settings for the meta-parameters and is in the form of one numeric *value per line, optionally followed by a single line comment preceded by *a # character. Typical examples of Gaussian duration distributions (gaussianDefs.X) *and modified gamma duration distributions (modifiedGammaDefs.X)are included the *directory and these can be edited to tweak the metaparameters. The format for *writing new files is * *i_0 # 0 if use HSMM decoder, 1 if only use HMM decoder for comparison *i_1 # 1 is use Gaussian duration distributions, 0 if use modfied gamma distribs *f_2 # mean of mean of duration distribution parameter *f_3 # sigma of mean of duration distribution parameter *f_4 # mean of variance of duration distribution parameter *f_5 # sigma of variance of duration distribution parameter *f_6 # mean of mean of feature distribution parameter *f_7 # sigma of mean of feature distribution parameter *f_8 # mean of variance of feature distribution parameter *f_9 # sigma of variance of feature distribution parameter *f_10 # transition matrix randomness (0 is all transition probabilities identical, * larger means greater randomness) *i_11 # maximum number of timesteps to generate in the output data * *where the i parameters are integers and the f parameters are floating point *numbers. At the start of the output in will be written a description of *the model generated from those parameters in the form of a list of states *with each states attributes being written there. In this output *Gaussians are written out as N(mean,sigma) (not N(mean,sigma^2)) and *modified gamma distributions are written out as MGamma(s,d,norm factor). *Then the probability of a transition from that state to the other states is *given in the form "-> @ ". As the HSMM *model does not have self transitions you will see that this probability is *always 0. * *NOTE: As the file parser will __not__ detect a malformed input file it is worth checking out these values *appear to be characteristic of what you wanted to acheive with the meta-parameters. *NOTE: The model instance generator generally produces slightly *fewer than max_steps worth of output. This is because for comparability of *likelihoods between the simulation and decoded results we must __end__ *the problem data at a transition. * *After running the program, will end with a series of records describing the *set of time-segments in a particular class that the most-likely interpretation has. *These are easier viewed in the plottable graphs below but it is useful to look *at them to see some of the detailed breakdown. The record * * {stTime=78 state=2 incSc=39.122 temp=3.69938 trans=1.0208 nonCI=0 #G =0}, * *means that at timestep 78 the most likely sequence transitions to state 2. (The time *it jumps out of state 2 is the same as the "jump in" time given in the next record.) *incSC gives the total negated-log-likelihood L of the given sequence of classes up to the point *at which it jumped _out_ of the state. The temp value gives the part of this L that *comes from the duration distribution and the trans value gives the part of this L *coming from the transition matrices between the states, with the rest of L coming *from the likelihoods of the observations given the class. (The nonCI and G entries *are not relevant here.) These values are _cumulative_, ie, record the change in those *values due to a given segment is the values in the record for that segment minus *the values in the record for the previous segment. The key point to take away from *looking at these records is that typically the temporal terms and transition terms are *__significantly__ smaller than the contribution coming from the observations. This *is to be expected, because in a sequence of T frames where the state changes N *times (with T significantly larger than N) there are only N individual duration *distribution and transition probability terms but T observation probability terms. *How can these smaller terms cause a difference in which decoding is most likely? *Because by rewarding sequences closer to the characteristic duration they lead to *an overall slightly lower score than could be obtained for those timesteps when *very ambiguous observations are seen from switching quickly in-and-out of *the state which happens to give the greater likelihood to these highly ambiguous *observations. Likewise, looking at the values gives an intuition for when the HSMM *model will not provide any real improvement over the HMM, namely when such a *high proportion of the observations are highly ambiguous that the duration distribution *does not exert enough "force" to compensate for them. * *Several other files as well as are produced as well. Those with *".distrib" extensions are in the form of "xValue yValue" listings suitable *for viewing with, eg, gnuplot. * *The main outputs of interest are trueNumericStates.distrib and *decode0.distrib which allow comparing the true and decoded states. * *trueNumericStates.distrib # timestep true-class listing *decode0.distrib # timestep inferred-class listing * *Within gnuplot you can use * plot "trueNumericStates.distrib" with lines,"decode0.distrib" with lines *to see the two curves on the same graph, where a line segment of y-value *in the trueNumericStates.distrib curve 0 means class 0, 1 means class 1, etc. *The same applies to decode0.distrib, except that a small constant vertical pertubation *is added to the decode0.distrib points so that the lines do not plot on top *of each other. * *The next most interesting files are * *smooth.distrib # timestep class-value listing *feature.distrib # timestep noisy-observation listing * *which can be plotted to see the basic class value and the actual noisy observation *produced at each timestep. (Looking at these is particularly useful to get some *idea of how much the Gaussian noise makes one output amibiguous between *classes and thus how much the decoding would have "needed to use" the duration *distribution to disambiguate things.) * *Finally, some files only for the really curious: * *We are abusing a continuous probability density (either Gaussian or *modified gamma) and using it restricted just to the integer timesteps. *To allow checking the degree of approximation of the two sets we have: * *testDist0.distrib, testDist1.distrib, testDist2.distrib, testDist3.distrib * # contains a duration discretised-probability analytic-probability-density * *Finally, we have a file listing just the state transitions and the times they occurred * *transitionPts # timestep-of-transition state-jumped-to listing * *suitable for checking against the compressed output of the decoder in . * *NOTE: The generated and decoded likelihoods generally differ slightly *due to issues in machine precsion and rounding. *NOTE: Sometimes the decoding algorithm will appear to fail quite *drastically. In those cases it is important to look at the numbers in the *model description written at the beginning of the output. Generally *what has happened is that, despite heuristics in the model generation *code to encourage minimally separable models, two of the classes *have been generated where the difference between the means is *over an order of magnitude smaller than the sum of the sigma's, so *that the class probability function for a given observation value is *virtually identical for the two classes. In this case the HSMM is not *expected to work any better than a HMM (although it will fail in a *different way) because the underlying "generating class signal" *in the observations is __consistenly__ very weak, whereas the *HSMM model assumes a __large proportion__ of the observations *are strongly indicative of the class interspersed with completely *misleading observations. Indeed, in general if you don't thing the feature *output (as shown in feature.distrib) was an uncommonly favourable or *unfavourable instance from the meta-parameters rerun the program until you get *something you like. Additionally, changing the first parameter in the *file to 1 to use a HMM decoder can provide a useful comparison *between the capabilities of the two models. *******************************************************************************/

近期下载者

相关文件


收藏者