{"action":"created","issue":{"url":"https://api.github.com/repos/mattjj/pyhsmm/issues/45","labels_url":"https://api.github.com/repos/mattjj/pyhsmm/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/mattjj/pyhsmm/issues/45/comments","events_url":"https://api.github.com/repos/mattjj/pyhsmm/issues/45/events","html_url":"https://github.com/mattjj/pyhsmm/issues/45","id":77139349,"number":45,"title":"HMM VLB","user":{"login":"nfoti","id":1437512,"avatar_url":"https://avatars.githubusercontent.com/u/1437512?v=3","gravatar_id":"","url":"https://api.github.com/users/nfoti","html_url":"https://github.com/nfoti","followers_url":"https://api.github.com/users/nfoti/followers","following_url":"https://api.github.com/users/nfoti/following{/other_user}","gists_url":"https://api.github.com/users/nfoti/gists{/gist_id}","starred_url":"https://api.github.com/users/nfoti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nfoti/subscriptions","organizations_url":"https://api.github.com/users/nfoti/orgs","repos_url":"https://api.github.com/users/nfoti/repos","events_url":"https://api.github.com/users/nfoti/events{/privacy}","received_events_url":"https://api.github.com/users/nfoti/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-16T21:41:51Z","updated_at":"2015-05-17T02:12:51Z","closed_at":"2015-05-17T02:12:51Z","body":"It looks like the part of the variational lower-bound for HMMs is computed with the [line](https://github.com/mattjj/pyhsmm/blob/master/pyhsmm/internals/hmm_states.py#L483) `normalizer = np.logaddexp.reduce(alphal[0] + betal[0])`, but this doesn't seem right.  I think it should be something like `np.sum(np.logaddexp.reduce(alphal, axis=1))` which computes the normalization for the forward messages at each time and then combines them.  This corresponds to Eq. (3.74) in Ch. 3 of Beal's thesis.  Maybe I'm missing some cleverness though."},"comment":{"url":"https://api.github.com/repos/mattjj/pyhsmm/issues/comments/102721960","html_url":"https://github.com/mattjj/pyhsmm/issues/45#issuecomment-102721960","issue_url":"https://api.github.com/repos/mattjj/pyhsmm/issues/45","id":102721960,"user":{"login":"mattjj","id":1458824,"avatar_url":"https://avatars.githubusercontent.com/u/1458824?v=3","gravatar_id":"","url":"https://api.github.com/users/mattjj","html_url":"https://github.com/mattjj","followers_url":"https://api.github.com/users/mattjj/followers","following_url":"https://api.github.com/users/mattjj/following{/other_user}","gists_url":"https://api.github.com/users/mattjj/gists{/gist_id}","starred_url":"https://api.github.com/users/mattjj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattjj/subscriptions","organizations_url":"https://api.github.com/users/mattjj/orgs","repos_url":"https://api.github.com/users/mattjj/repos","events_url":"https://api.github.com/users/mattjj/events{/privacy}","received_events_url":"https://api.github.com/users/mattjj/received_events","type":"User","site_admin":false},"created_at":"2015-05-17T02:12:51Z","updated_at":"2015-05-17T02:12:51Z","body":"I believe it's correct as it is: Eq. (3.60) in that thesis shows that Z is just the normalizer for the HMM MRF, which we can compute from combining the forwards and backwards the messages at any one index (like the code does using the first index). The \\zeta defined Eq. (3.22) comprise an alternative way of writing the log normalizer in terms of filtering predictive probabilities (which turns out to be the most convenient way to compute the log normalizer for Gausisan LDS as far as I can tell!), but they're not the local potential normalizers from the two-way messages.\r\n\r\nActually something I realized (which isn't clear in Beal's thesis) is that this same thing happens for any conjugate mean field update to an exponential family factor, and this update to the HMM factor is just an instance of that phenomenon: right after the factor gets updated, its VLB term is just its log normalizer evaluated at its new variational natural parameters. Here are some symbols for an analogous (but not fully general) setup:\r\n\r\n![latex-image-1](https://cloud.githubusercontent.com/assets/1458824/7668778/ab7e1a3e-fc18-11e4-8ce8-2873eef24f24.png)\r\n\r\n(Apologies for any errors in that, which I typeset quickly, but I believe the general idea should be right!)"}}