markov

Hidden Markov Model predicting next observation

我怕爱的太早我们不能终老 提交于 2019-12-04 08:37:39
问题 I have a sequence of 500 observations of the movements of a bird. I want to predict what the 501st movement of the bird would be. I searched the web and I guess this can be done by using HMM, however I do not have any experience on that subject. Can anyone explain the steps of an algorithm used to solve this problem? 回答1: x1-x2-x3-x4-x5......x500-x501 | | | | | | y1 y2 y3 y4 y5 y500 x - actual state y - observations P(y_i|x_i) - how you think the observation depends on the actual state P(x_i

Storing values from a loop in a function in Matlab

亡梦爱人 提交于 2019-12-04 05:26:12
问题 I am writing a function in Matlab to model the length of stay in hospital of stroke patients. I am having difficulty in storing my output values. Here is my function: function [] = losdf(age, strokeType, dest) % function to mdetermine length of stay in hospitaal of stroke patients % t = time since admission (days); % age = age of patient; % strokeType = 1. Haemorhagic, 2. Cerebral Infarction, 3. TIA; % dest = 5.Death 6.Nursing Home 7. Usual Residence; alpha1 = 6.63570; beta1 = -0.03652;

Creating a matrix of arbitrary size where rows sum to 1?

喜夏-厌秋 提交于 2019-12-04 05:06:53
My task is to create a program that simulates a discrete time Markov Chain, for an arbitrary number of events. However, right now the part I'm struggling with is creating the right stochastic matrix that will represent the probabilities. A right stochastic matrix is a matrix that has row entries that sum to 1. And for a given size, I kind of know how to write the matrix that does that, however, the problem is that I don't know how to do that for an arbitrary size. For example: here is my code for a 3x3 matrix, along with example of the output I was getting. http://pastebin.com/4GXpAYTM However

“Anagram solver” based on statistics rather than a dictionary/table?

不打扰是莪最后的温柔 提交于 2019-12-03 19:11:19
问题 My problem is conceptually similar to solving anagrams, except I can't just use a dictionary lookup. I am trying to find plausible words rather than real words. I have created an N-gram model (for now, N=2) based on the letters in a bunch of text. Now, given a random sequence of letters, I would like to permute them into the most likely sequence according to the transition probabilities. I thought I would need the Viterbi algorithm when I started this, but as I look deeper, the Viterbi

Understanding Markov Chain source code in R

此生再无相见时 提交于 2019-12-02 08:20:40
The following source code is from a book. Comments are written by me to understand the code better. #================================================================== # markov(init,mat,n,states) = Simulates n steps of a Markov chain #------------------------------------------------------------------ # init = initial distribution # mat = transition matrix # labels = a character vector of states used as label of data-frame; # default is 1, .... k #------------------------------------------------------------------- markov <- function(init,mat,n,labels) { if (missing(labels)) # check if 'labels'

Storing values from a loop in a function in Matlab

对着背影说爱祢 提交于 2019-12-02 05:12:25
I am writing a function in Matlab to model the length of stay in hospital of stroke patients. I am having difficulty in storing my output values. Here is my function: function [] = losdf(age, strokeType, dest) % function to mdetermine length of stay in hospitaal of stroke patients % t = time since admission (days); % age = age of patient; % strokeType = 1. Haemorhagic, 2. Cerebral Infarction, 3. TIA; % dest = 5.Death 6.Nursing Home 7. Usual Residence; alpha1 = 6.63570; beta1 = -0.03652; alpha2 = -3.06931; beta2 = 0.07153; theta0 = -8.66118; theta1 = 0.08801; mu1 = 22.10156; mu2 = 2.48820; mu3