- 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
推薦閱讀
- 電腦常見問(wèn)題與故障排除
- 微軟互聯(lián)網(wǎng)信息服務(wù)(IIS)最佳實(shí)踐 (微軟技術(shù)開發(fā)者叢書)
- Spring Cloud微服務(wù)架構(gòu)實(shí)戰(zhàn)
- 筆記本電腦使用、維護(hù)與故障排除從入門到精通(第5版)
- 深入理解序列化與反序列化
- Intel Edison智能硬件開發(fā)指南:基于Yocto Project
- 基于PROTEUS的電路設(shè)計(jì)、仿真與制板
- WebGL Hotshot
- FL Studio Cookbook
- 基于網(wǎng)絡(luò)化教學(xué)的項(xiàng)目化單片機(jī)應(yīng)用技術(shù)
- 計(jì)算機(jī)電路基礎(chǔ)(第2版)
- Building Machine Learning Systems with Python
- Instant Website Touch Integration
- 新編計(jì)算機(jī)組裝與維護(hù)
- Hands-On Unsupervised Learning with Python