- Hands-On Markov Models with Python
- Ankur Ankan Abinash Panda
- 194字
- 2021-07-23 19:12:05
Absorbing states
State i is said to be an absorbing state if it is impossible for a system to leave that state once it reaches it. For a state to be an absorbing state, the probability of staying in the same state should be 1, and all the other probabilities should be 0:

In a Markov chain, if all the states are absorbing, then we call it an absorbing Markov chain:

Figure 1.7: An example showing an absorbing state C, since the probability of transitioning from state C to C is 1
Again, we can add a very simple method to check for absorbing states in our MarkovChain class:
def is_absorbing(self, state):
"""
Checks if the given state is absorbing.
Parameters
----------
state: str
The state for which we need to check whether it's absorbing
or not.
"""
state_index = self.index_dict[state]
if self.transition_matrix[state_index, state_index]
We can again check whether our state in the example is absorbing by creating a Markov chain and using the is_absorbing method:
>>> absorbing_matrix = [[0, 1, 0],
[0.5, 0, 0.5],
[0, 0, 1]]
>>> absorbing_chain = MarkovChain(transition_matrix=absorbing_matrix,
states=['A', 'B', 'C'])
>>> absorbing_chain.is_absorbing('A')
False
>>> absorbing_chain.is_absorbing('C')
True
推薦閱讀
- ATmega16單片機項目驅動教程
- Windows phone 7.5 application development with F#
- FPGA從入門到精通(實戰篇)
- Manage Partitions with GParted How-to
- Artificial Intelligence Business:How you can profit from AI
- 筆記本電腦維修實踐教程
- 單片機原理與技能訓練
- 基于網絡化教學的項目化單片機應用技術
- 嵌入式系統原理及應用:基于ARM Cortex-M4體系結構
- 微控制器的應用
- 微服務實戰
- 嵌入式系統設計大學教程(第2版)
- 創客電子:Arduino和Raspberry Pi智能制作項目精選
- 筆記本電腦現場維修實錄
- Applied Deep Learning with Keras