- Hands-On Markov Models with Python
- Ankur Ankan Abinash Panda
- 383字
- 2021-07-23 19:12:04
Transience and recurrence
Given that we start at state i, it is called transient if there is a non-zero probability that we will never return to state i. To define this in more formal terms, let's consider a random variable Ti as the first return time to state i:

Let's now define another term, , as the probability of the system returns to state i after n steps:

Now we can define that any given state i is transient if the following condition is met:

In the preceding equation, we are basically checking whether the total sum of probabilities of returning to state i in step sizes less than is less than 1. If the total sum is less than 1, it would mean that the probability of Ti to be
is greater than 0 which would mean that the state i is transient. The given state i is called recurrent if it is not transient:

In the preceding example, we can see that states A and B are transient because A doesn't have any incoming edge. B does have an incoming edge, but it's incoming from another transient state and therefore it is also transient. Hence, once the system leaves state A or B, it won't be able to come back.
It is really simple to check whether a given state is transient or not. We can simply check whether there are any incoming edges from other states or not. If not, the state is transient. Let's write a simple method to check this for our MarkovChain class:
def is_transient(self, state):
"""
Checks if a state is transient or not.
Parameters
----------
state: str
The state for which the transient property needs to be checked.
"""
if all(self.transition_matrix[~self.index_dict[state], self.index_dict[state]] == 0):
return True
else:
return False
Now we can use this method in our example in Figure 1.6 to check which nodes are transient:
>>> transient_matrix = [[0, 0.5, 0.5, 0],
[0, 0, 0.25, 0.75],
[0, 0, 0, 1],
[0, 0, 0.5, 0.5]]
>>> transient_markov = MarkovChain(transition_matrix=transient_matrix,
states=['A', 'B', 'C', 'D'])
>>> transient_markov.is_transient('A')
True
>>> transient_markov.is_transient('B')
True
>>> transient_markov.is_transient('C')
False
In the following subsections, we will talk about the statistical properties of the random variable Ti.
- Arduino入門基礎教程
- Instant uTorrent
- 電腦組裝與維修從入門到精通(第2版)
- Linux運維之道(第2版)
- 電腦常見故障現場處理
- 基于ARM的嵌入式系統和物聯網開發
- 3ds Max Speed Modeling for 3D Artists
- AMD FPGA設計優化寶典:面向Vivado/SystemVerilog
- micro:bit魔法修煉之Mpython初體驗
- Machine Learning Solutions
- 無蘋果不生活:OS X Mountain Lion 隨身寶典
- 圖解計算機組裝與維護
- Hands-On Deep Learning for Images with TensorFlow
- 3D Printing Blueprints
- USB應用分析精粹:從設備硬件、固件到主機端程序設計