加权自动机的对数半环中的最短距离

发布于 2025-01-01 02:39:42 字数 675 浏览 0 评论 0原文

我以为我已经弄清楚了......但我仍然无法理解它。 我正在玩 OpenFst 并试图弄清楚如何在“对数”半环中计算“最短距离”。 对于以下小自动机,

https://i.sstatic.net/9j2Yf.png

结果‘shortestdistance’命令的值为,

$ fstshortestdistance log.fst
0   0
1   -0.510825634
2   -2.60798359
3   -0.9162907

并且日志中最短距离的描述为,

使用对数半环,计算 q 的路径权重的(对数)总和。

我觉得很愚蠢,但我无法弄清楚到底发生了什么才能达到最终的 -2.6。我已经尝试了我能想到的对数和普通和的每一种变体,即使是那些看起来不应该适用的变体,但没有任何结果是-2.6。现在它开始让我发疯了。

在这种情况下,我的直觉是应该将两个不同字符串(bc,bd)中每一个的总路径概率相加,然后返回最佳概率。 (bc) 有两条路径,它们的概率总和为 2/3(非对数)。 (bd) 路径的概率为 1/3。然而,这绝对不是正在发生的事情,那么到底发生了什么呢?

I thought I'd figured this out... but I still cannot wrap my head around it.
I'm playing with OpenFst and trying to figure out how 'shortestdistance' is calculated in the 'log' semiring.
For the following little automaton,

https://i.sstatic.net/9j2Yf.png

The result of the 'shortestdistance' command is,

$ fstshortestdistance log.fst
0   0
1   -0.510825634
2   -2.60798359
3   -0.9162907

and the description for shortestdistance in log is given as,

With the log semiring, the (log) sum of path weights to q is computed.

I feel pretty dumb but I cannot figure out what is actually happening to arrive at the final -2.6. I've tried every variation of the logsum and ordinary sum that I can think of, even ones that seem like they shouldn't apply, but nothing yields -2.6. It's starting to drive me crazy now.

My intuition in this case is that the total path probabilities for each of the two distinct strings (bc, bd) should be summed, and then the best probability should be returned. There are two paths for (bc) and their probabilities sum to 2/3 (non-log). The (bd) path has probability 1/3. However, this is definitely not what is happening, so what is happening?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

等待圉鍢 2025-01-08 02:39:42

对数半环中两个值“x”和“y”的对数和定义为:

-log(exp(-x) + exp(-y))

和对数半环中的最短距离应该计算与您定义的自动机相关的总似然。路径输出字符串不相关,但存在三个不同的路径,具有以下关联的路径权重:

x = (0,1,2):-.51083

y = (0,3,2):-1.2729 = -.91629 + -.35667

z = (0,3,2):-2.1202 = -.91629 + -1.204

如果我们根据得到的对数和对 x、y 和 z 求和,

-log(exp(-x) + exp(-y) + exp(-z) ) = -2.607

这是 OpenFst 将产生的结果。我猜你忘记了那些讨厌的负面信号。

The logsum of two values, 'x' and 'y' in the log semiring is defined as,

-log( exp(-x) + exp(-y) )

and the shortest-distance in the log semiring should compute the total likelihood associated with the automaton you've defined. The path output strings aren't relevant, but there are three distinct paths with the following associated path weights:

x = (0,1,2):-.51083

y = (0,3,2):-1.2729 = -.91629 + -.35667

z = (0,3,2):-2.1202 = -.91629 + -1.204

If we sum x, y and z according to the logsum we get,

-log( exp(-x) + exp(-y) + exp(-z) ) = -2.607

Which is what OpenFst will produce. My guess is that you forgot the pesky negative signs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文