<p>Yes this is possible and is exactly what a <a href="https://en.wikipedia.org/wiki/Markov_chain" rel="nofollow noreferrer">Markov process</a> aims to accomplish.</p>

<p>The <a href="https://en.wikipedia.org/wiki/Hidden_Markov_model" rel="nofollow noreferrer">Hidden Markov Model</a> can be considered a simple dynamic Bayesian network. This means that it will generate a probabilistic outcome for a number of states (classes) given a sequence of inputs.</p>

<p>This can be used for a classification task based on a threshold probability to make a confirmed decision.</p>

<p>Let's take a simple example</p>

<p><a href="https://i.sstatic.net/4fmgJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4fmgJ.png" alt="Example"></a></p>

<p>The above example is a model to determine  how a person will be feeling given some sample data of the previous days.</p>



<pre><code># Sample data
data = ['Healthy', 'Healthy', 'Fever']
</code></pre>

<p>Using this data, it's possible to calculate the probability of each possible state (outcome).</p>



<pre><code># Probability after 2 Healthy and 1 Fever day
P = 0.6 * 0.7 * 0.3

# Final day state 'Fever'
# Calculating probabilities for each state
Dizzy  = P * 0.6
Cold   = P * 0.3
Normal = P * 0.1
</code></pre>

<p>We can calculate the probability of each state and this will be unique for every unique sequence of historical data.</p>

CC BY-SA 4.0
2019-06-19T18:44:29.633Z
Do you have example code?
drerD
CC BY-SA 4.0
2019-06-19T21:05:36.960Z
Code for this example? Or in general? The issue is that HMMs are not easy to generate. The probabilities, specified in the example are dummies, in a real use case, those values will have to be computed statistically from a large dataset before the model can be used.
skillsmuggler
CC BY-SA 4.0
2019-06-20T00:21:38.393Z
code in general is fine. I’ve tried a python package, but I can only do decoding to get a sequence of states, while I want to get the state of a single input.
drerD
CC BY-SA 4.0
2019-06-19T16:53:21.500Z
2019-06-19T16:53:21.500Z
skillsmuggler
<p>I learn that the <strong>Viterbi</strong> algorithm used for Hidden Markov Model (<strong>HMM</strong>) can classify a sequence of hidden states from the corresponding observations; Markov Random Field (<strong>MRF</strong>) and Conditional Random Field (<strong>CRF</strong>) can also do it. </p>

<p>Can these algorithms be used to classify a single future state?</p>

<markov-chain><sequence-modeling><time-series><hidden-markov-model>
Can HMM, MRF, or CRF be used to classify the state of a single observation, not the entire observation sequence?
drerD
# Can HMM, MRF, or CRF be used to classify the state of a single observation, not the entire observation sequence?

(Asked by: username_0 on 2019-06-18)

I learn that the **Viterbi** algorithm used for Hidden Markov Model (**HMM**) can classify a sequence of hidden states from the corresponding observations; Markov Random Field (**MRF**) and Conditional Random Field (**CRF**) can also do it.

Can these algorithms be used to classify a single future state?

**Tags:** markov-chain, sequence-modeling, time-series, hidden-markov-model


---

## 1 answers

### Answer by username_1 on 2019-06-19. Score: 0

Yes this is possible and is exactly what a Markov process aims to accomplish.
The Hidden Markov Model can be considered a simple dynamic Bayesian network. This means that it will generate a probabilistic outcome for a number of states (classes) given a sequence of inputs.
This can be used for a classification task based on a threshold probability to make a confirmed decision.
Let's take a simple example

The above example is a model to determine  how a person will be feeling given some sample data of the previous days.
# Sample data
data = ['Healthy', 'Healthy', 'Fever']

Using this data, it's possible to calculate the probability of each possible state (outcome).
# Probability after 2 Healthy and 1 Fever day
P = 0.6 * 0.7 * 0.3

# Final day state 'Fever'
# Calculating probabilities for each state
Dizzy  = P * 0.6
Cold   = P * 0.3
Normal = P * 0.1

We can calculate the probability of each state and this will be unique for every unique sequence of historical data.

> **Comments:**
> **username_0**: Do you have example code?  
> **username_1**: Code for this example? Or in general? The issue is that HMMs are not easy to generate. The probabilities, specified in the example are dummies, in a real use case, those values will have to be computed statistically from a large dataset before the model can be used.  
> **username_0**: code in general is fine. I’ve tried a python package, but I can only do decoding to get a sequence of states, while I want to get the state of a single input.  

---

