2022-07-22

This article is categorized as "Garbage" . It should NEVER be appeared in your search engine's results.


N-gram模型与k-order Markov model

N-gram模型

最开始在这里看到:《Fundamentals of ...》 P288

总结:其实bigrams就是最常见的齐次马尔可夫链:时刻[mathjax]t[/mathjax]的状态只和时刻[mathjax]t-1[/mathjax]有关;n-gram就是[mathjax](n-1)^{th}{\text -}\text{order Markov model}[/mathjax]

中文翻译为「n元语法」:🔗 [n元语法 - 维基百科,自由的百科全书] https://zh.wikipedia.org/zh-hans/N元语法

为了防止遗忘最原始的马尔可夫状态的定义,最好复习:🔗 [2021-12-21 - Truxton's blog] https://truxton2blog.com/2021-12-21/

优先看这篇文章:🔗 [自然语言处理 03:N-gram 语言模型 - YEY 的博客 | YEY Blog] https://yey.world/2020/03/09/COMP90042-03/#2-n-gram-语言模型

这篇文章容易看懂,但似乎有一处不太严谨的表达:🔗 [自然语言处理中N-Gram模型介绍 - 知乎] https://zhuanlan.zhihu.com/p/32829048

最标准markov chain的定义里,当前的词仅仅和上一个词相关。图中描述的其实是markov chain的变体。

再阅读这个总结性链接:🔗 [Lecture 3: Markov Models as Language Model] https://staff.fnwi.uva.nl/k.simaan/D-Courses2013/D-NLMI2013/college3.pdf

摘选最关键的3页PDF:

不同PDF阅读器的显示效果不同,如果渲染PDF出现偏差,请尝试其他PDF阅读器

所以最后得出总结:

一元模型unigram model就是各个时刻的状态都相互独立的概率模型,称为[mathjax]0^{th}{\text -}\text{order Markov model}[/mathjax];

二元模型bigram model就是个最标准最普通的马尔可夫链模型(时刻[mathjax]t[/mathjax]的状态只和时刻[mathjax]t-1[/mathjax]有关),所以《Fundamentals of …》书中使用的就是bigrams ,称为[mathjax]1^{th}{\text -}\text{order Markov model}[/mathjax]

三元模型trigram还没接触过,先不管了。但需要记住它又被称为[mathjax]2^{th}{\text -}\text{order Markov model}[/mathjax] .

接下来的四元模型五元模型...称为[mathjax]k^{th}{\text -}\text{order Markov model}[/mathjax]

可能会引起迷惑的Wikipedia定义

🔗 [Variable-order Markov model - Wikipedia] https://en.wikipedia.org/wiki/Variable-order_Markov_model

In the mathematical theory of stochastic processes, variable-order Markov (VOM) models are an important class of models that extend the well known Markov chain models. In contrast to the Markov chain models, where each random variable in a sequence with a Markov property depends on a fixed number of random variables, in VOM models this number of conditioning random variables may vary based on the specific observed realization.

https://en.wikipedia.org/wiki/Variable-order_Markov_model

而另一个wikipedia又这么说:

🔗 [Markov chain - Wikipedia] https://en.wikipedia.org/wiki/Markov_chain

A Markov chain or Markov process is a stochastic model describing a sequence of possible events in which the probability of each event depends only on the state attained in the previous event.

https://en.wikipedia.org/wiki/Markov_chain

搞不清楚,先放在这里吧。

k-order Markov model是否就是Variable-order Markov model?

似乎还不太一样。k-order markov model=n-gram,定义是「某一时刻的state和前(k-1)个state相关」,而variable-order morkov model的定义是「某一时刻的state至多和前(k-1)个state相关」。

计算N-gram模型的方法

目前学到的方法只有1个:最暴力的查找与统计。好像还有优化程序,但没来得及看:🔗 [Markov Model of Natural Language] https://www.cs.princeton.edu/courses/archive/spring11/cos126/assignments/markov.html

(来自🔗 [自然语言处理 03:N-gram 语言模型 - YEY 的博客 | YEY Blog] https://yey.world/2020/03/09/COMP90042-03/#2-n-gram-语言模型

unigram模型:

[mathjax-d]P\left(w_{i}\right)=\frac{C\left(w_{i}\right)}{M}[/mathjax-d]

M:总词汇数,[mathjax]C(w_i)[/mathjax]:对[mathjax]w_i[/mathjax]的统计个数. 是个古典概率模型。

bigram模型:

[mathjax-d]P\left(w_{i} \mid w_{i-1}\right)=\frac{C\left(w_{i-1}, w_{i}\right)}{C\left(w_{i-1}\right)}[/mathjax-d]

n-gram模型:

[mathjax-d]P\left(w_{i} \mid w_{i-n+1}, \ldots, w_{i-1}\right)=\frac{C\left(w_{i-n+1}, \ldots, w_{i}\right)}{C\left(w_{i-n+1}, \ldots, w_{i-1}\right)}[/mathjax-d]

A concrete example:

不同PDF阅读器的显示效果不同,如果渲染PDF出现偏差,请尝试其他PDF阅读器

试图学习和弦的推导与转调问题(没有实质性内容)

和弦的推导与转调问题(中途跑题了)

从一个单独笔记里分离出来:

本节的目的不是记住和弦的频率比,而是学习 转调前后和弦的频率比是否遵循一定规律 .

首先是major triad和minor triad的和弦频率比:

major: 4:5:6

minor: 10:12:15

然后...

哎呀,卡住了,学不下去。事实上,topic可能写的不太合理(这个topic貌似是我臆想出来的,试图强行找规律),目前还没找到合适的资料去阐述“转调(transposition)遵循什么规律”。《Fundamentals of …》对转调的介绍非常简单,就是纯粹的“在12平均律上固定滑动” (比如1 3 5集体向右滑动1个semitone变成2 4 6).

试图学点什么:🔗 [2022-03-29 - Truxton's blog] https://truxton2blog.com/2022-03-29/#三和弦的推导

但后来想了想,觉得还是不太对:

上面这点东西学得还是不够深入,所以最后决定:

1,把这篇笔记并入2022-07-22,然后埋了;

2,新开一篇笔记重新整理chord乐理知识。



 Last Modified in 2022-07-24 

Leave a Comment Anonymous comment is allowed / 允许匿名评论