在机器学习和统计学习中,正态分布的身影无处不在,最为常见的是标准正态分布和多元正态分布 (multivariate normal distribution),两者分别作用于标量 (scalar) 和向量 (vector)。实际上,也存在一种正态分布的形式,它作用于矩阵,并广泛地应用于贝叶斯向量自回归模型 (Bayesian vector autoregression) 中。本文接下来将从大家所熟知的正态分布出发,先介绍矩阵正态分布,然后讨论矩阵正态分布在贝叶斯方法中的应用。
从标准正态分布到矩阵正态分布
def mnrnd(M, U, V):
"""
Generate matrix normal distributed random matrix.
M is a m-by-n matrix, U is a m-by-m matrix, and V is a n-by-n matrix.
"""
import numpy as np
X0 = np.random.rand(M.shape)
P = np.linalg.cholesky(U)
Q = np.linalg.cholesky(V)
return M + np.matmul(np.matmul(P, X0), Q.T)
参考
2. http://faculty.wcas.northwestern.edu/~lchrist/course/Korea_2016/bayesian_VAR_handout.pdf
3. https://www.oru.se/globalassets/oru-sv/institutioner/hh/workingpapers/workingpapers2012/wp-12-2012.pdf
4. https://www.michaelchughes.com/blog/probability-basics/autoregressive-time-series-models/
5. https://www.ucm.es/data/cont/media/www/pag-105960/BVARs.pdf
作者:知乎-Xinyu Chen
地址:https://www.zhihu.com/people/its31