概述
转移矩阵记录了这些概率,并可用于计算多步行为。只有当所选的状态和转移假设符合实际过程时,该模型才有用。
深入探讨
The states of a Markov chain are the categories the model tracks at each step. The Markov property says that, conditional on the present state, the next-state distribution does not additionally depend on the earlier sequence of states. It is an assumption about the chosen state representation, not a claim that real life has no history. A state that omits important context, such as how long a machine has been failing, may not make the next transition adequately predictable. For a simple time-homogeneous two-state weather example, let the states be sunny and rainy. From sunny, suppose tomorrow is sunny with probability 0.8 and rainy with probability 0.2. From rainy, suppose tomorrow is sunny with probability 0.4 and rainy with probability 0.6. Put these in rows of a transition matrix, ordered sunny then rainy: the first row is 0.8, 0.2 and the second is 0.4, 0.6. Each row sums to one because the next day must be in one of the defined states. These numbers are invented for illustration, not a weather forecast. Starting from sunny, the chance of rain two days later is 0.8 × 0.2 plus 0.2 × 0.6, or 0.28. One path goes through sunny and the other through rainy. Matrix multiplication performs this path accounting for every state pair; the square of the one-step transition matrix gives two-step probabilities. A stationary distribution is a mixture of states unchanged by another transition. For this illustrative matrix, two-thirds sunny and one-third rainy is stationary: the next sunny share is (2/3 × 0.8) + (1/3 × 0.4) = 2/3. That is a long-run mathematical property of the model, not a promise that any particular day is sunny. Some chains have multiple stationary distributions or do not converge from every starting state, so do not assume every chain forgets its start. Evaluate the transition estimates on relevant data and revisit them when conditions change.
现实世界的实施
一个天气练习使用晴天和雨天状态来计算明天以及两天后下雨的概率。
技术支持团队对工单状态之间的移动进行建模,同时检查在状态定义中是否必须包含客户历史记录。
可靠性分析师利用观测到的运行周期来估计设备在工作状态和损坏状态之间的转换。
一位老师将单标记文本链与可以使用更长上下文的语言模型进行了对比。
马尔可夫链的未来
马尔可夫模型仍然很有用,因为它们的假设和计算是可检查的。它们支持教学、可靠性分析和一些顺序模拟,而更丰富的模型可以添加隐藏状态、不同的转移速率或更多的上下文。在文本生成中,仅基于短状态的下一个标记规则可以演示序列概率,但无法捕获语言中的所有长距离依赖关系。即使现代 AI 系统也预测序列,它们也可能使用非常不同的架构。未来的应用应记录状态定义、检查转移模式是否发生漂移,并对照保留序列将模型与替代方案进行比较。一个方便的矩阵并不能证明该过程真的是无记忆的。
付诸实践
为什么这很重要
- 更清晰的判决. 它可以帮助您将清晰的技术声明与营销语言分开。
- 成本与预算. 在花费金钱或时间之前,您可以提出更好的实施问题。
- 团队与工作流程. 具有共同理解的团队可以做出更好的产品、政策和学习决策。
留意
- 不同的团队可能会以不同的方式使用同一术语,因此请尽早定义范围。
- 基准测试可能看起来很强大,但实际性能却参差不齐。
- 忽视数据质量和评估计划通常会产生脆弱的结果。
后续步骤
- 从您需要的结果的简单语言定义开始。
- 在测试之前选择一种成功指标和一种失败条件。
- 使用代表性数据运行小型试点,而不是完善的演示集。
- 记录马尔可夫链发挥作用的地方以及更简单的方法更好的地方。
不断探索
常见问题
什么是马尔可夫链?
马尔可夫链对状态之间的移动进行建模:在给定模型的情况下,下一个状态的概率取决于当前状态,而不是整个先前的路径。转移矩阵记录了这些概率,并可用于计算多步行为。只有当所选的状态和转移假设符合实际过程时,该模型才有用。
在本指南中,马尔可夫性质对预测下一个状态有什么说法?
该性质取决于所选的当前状态;它并不声称是确定性转换,也不声称现实过程字面上没有历史。
为什么指南中转移矩阵的每一行的总和必须为一?
从一个当前状态出发,所有已定义的可能下一个状态的概率穷尽了所有结果,其总和为一。
如果在指南的示例矩阵中今天是晴天,那么明天天下雨的概率是多少?
晴天行是 [0.8 晴天, 0.2 雨天],因此从晴天到雨天的一步转换概率是 0.2。
从晴天开始,指南示例中两天后下雨的概率是多少?
两条可能的中间路径贡献了 0.8 × 0.2 和 0.2 × 0.6,它们的总和是 0.28。
是什么使状态分布对于转移矩阵来说是平稳的?
A stationary distribution satisfies πP = π; one step leaves the distribution the same.