hidden-markov-models

PyMC: How can I describe a state space model?

夙愿已清 提交于 2020-01-05 12:12:26
问题 I used to code my MCMC using C. But I'd like to give PyMC a try. Suppose X_n is the underlying state whose dynamics following a Markov chain and Y_n is the observed data. In particular, Y_n has Poisson distribution with mean depending on X_n and a multidimensional unknown parameter theta X_n | X_{n-1} has distribution depending on theta How should I describe this model using PyMC? Another question: I can find conjugate priors for theta but not for X_n. Is it possible to specify which

PyMC: How can I describe a state space model?

▼魔方 西西 提交于 2020-01-05 12:12:24
问题 I used to code my MCMC using C. But I'd like to give PyMC a try. Suppose X_n is the underlying state whose dynamics following a Markov chain and Y_n is the observed data. In particular, Y_n has Poisson distribution with mean depending on X_n and a multidimensional unknown parameter theta X_n | X_{n-1} has distribution depending on theta How should I describe this model using PyMC? Another question: I can find conjugate priors for theta but not for X_n. Is it possible to specify which

Learning Discrete HMM parameters in PyMC

本秂侑毒 提交于 2020-01-03 04:55:12
问题 I am trying to learn the parameters of a simple discrete HMM using PyMC. I am modeling the rainy-sunny model from the Wiki page on HMM. The model looks as follows: I am using the following priors. theta_start_state ~ beta(20,10) theta_transition_rainy ~beta(8,2) theta_transition_sunny ~beta(2,8) theta_emission_rainy ~ Dirichlet(3,4,3) theta_emission_sunny ~ Dirichlet(10,6,4) Initially, I use this setup to create a training set as follows. ## Some not so informative priors! # Prior on start

Baum-Welch many possible observations

做~自己de王妃 提交于 2020-01-03 04:46:07
问题 I have implemented the baum-welch algorithm in python but I am now encountering a problem when attempting to train HMM (hidden markov model) parameters A , B , and pi . The problem is that I have many observation sequences Y = (Y_1=y_1, Y_2=y_2,...,Y_t=y_t) . And each observation variable Y_t can take on K possible values, K=4096 in my case. Luckily I only have two states N=2 , but my emission matrix B is N by K so 2 rows by 4096 columns. Now when you initialize B, each row must sum to 1.

Getting the next observation from a HMM gaussian mixture distribution

五迷三道 提交于 2020-01-02 08:09:19
问题 I have a continuous univariate xts object of length 1000, which I have converted into a data.frame called x to be used by the package RHmm . I have already chosen that there are going to be 5 states and 4 gaussian distributions in the mixed distribution. What I'm after is the expected mean value for the next observation. How do I go about getting that? So what I have so far is: a transition matrix from running the HMMFit() function a set of means and variances for each of the gaussian

Getting the next observation from a HMM gaussian mixture distribution

女生的网名这么多〃 提交于 2020-01-02 08:09:11
问题 I have a continuous univariate xts object of length 1000, which I have converted into a data.frame called x to be used by the package RHmm . I have already chosen that there are going to be 5 states and 4 gaussian distributions in the mixed distribution. What I'm after is the expected mean value for the next observation. How do I go about getting that? So what I have so far is: a transition matrix from running the HMMFit() function a set of means and variances for each of the gaussian

What is the equivalent for a Hidden Markov Model in the WEKA toolkit?

纵饮孤独 提交于 2020-01-01 05:48:08
问题 I need to classify a datastream which comes from a sensor network consisting of 8 accelerometers. Each accelerometer gives me a X Y and Z value. Thus at each sample i have 8 x 3 = 24 acceleration values. I sample at about 30 hz and the performance time is about 0.5 seconds. At first i thought of using a Hidden Markov model for this but it seems that the WEKA toolkit does not provide such a thing. What is the WEKA equivalent for this? Thank you. EDIT: how to format data? I have collected data

How to specify initial probability values for variables in a dynamic Bayesian network using Bayes server

回眸只為那壹抹淺笑 提交于 2019-12-24 08:25:38
问题 I am trying to create a dynamic Bayesian network for parameter learning using the Bayes server in C# in my Unity game. The implementation is based on this article. A brief explanation of the model shown in the figure below: When a player starts playing the level I assign them an initial probability of 0.5 that they already know the stuff that they are learning which is represented as Prior node in the network shown with the associated variable called as priorKnowledge . This prior node is

scikit-learn GaussianHMM ValueError: input must be a square array

独自空忆成欢 提交于 2019-12-23 21:24:45
问题 I am working with scikit-learn's GaussianHMM and am getting the following ValueError when I try to fit it to some observations. here is code that demonstrates the error: >>> from sklearn.hmm import GaussianHMM >>> arr = np.matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> arr matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> gmm = GaussianHMM () >>> gmm.fit (arr) /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/lib/function_base.py:2005: RuntimeWarning: invalid value

What pymc3 Monte-Carlo stepper can I use for a custom categorical distribution?

穿精又带淫゛_ 提交于 2019-12-23 04:53:25
问题 I am working on implementing hidden-Markov-Chains in pymc3. I have gotten pretty far in implementing the hidden states. Below, I am showing a simple 2-state Markov-chain: import numpy as np import pymc3 as pm import theano.tensor as tt # Markov chain sample with 2 states that was created # to have prob 0->1 = 0.1 and prob 1->0 = 0.3 sample = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,