1.9 Tensor Decompositions and N-Way Data Arrays
- Kronecker product
假设 A \textbf{A} A为m×n的矩阵, B \textbf{B} B为p×q的矩阵:
A = [ a 11 ⋯ a 1 n ⋮ ⋱ ⋮ a m 1 ⋯ a m n ] \textbf{A}= \begin{bmatrix} a_{11}&\cdots&a_{1n}\\ \vdots&\ddots&\vdots\\ a_{m1}&\cdots&a_{mn}\\ \end{bmatrix} A=⎣ ⎡a11⋮am1⋯⋱⋯a1n⋮amn⎦ ⎤
B = [ b 11 ⋯ b 1 q ⋮ ⋱ ⋮ a p 1 ⋯ a p q ] \textbf{B}= \begin{bmatrix} b_{11}&\cdots&b_{1q}\\ \vdots&\ddots&\vdots\\ a_{p1}&\cdots&a_{pq}\\ \end{bmatrix} B=⎣ ⎡b11⋮ap1⋯⋱⋯b1q⋮apq⎦ ⎤
则A与B的Kronecker product是一个大小为mp×nq的矩阵,即其为任意大小矩阵的运算,其表述为:
A ⊗ B = [ a 11 B ⋯ a 1 n B ⋮ ⋱ ⋮ a m 1 B ⋯ a m n B ] \textbf{A}\otimes \textbf{B}= \begin{bmatrix} a_{11}\textbf{B}& \cdots &a_{1n}\textbf{B}\\ \vdots&\ddots&\vdots\\ a_{m1}\textbf{B}&\cdots &a_{mn}\textbf{B}\\ \end{bmatrix} A⊗B=⎣ ⎡a11B⋮am1B⋯⋱⋯a1nB⋮amnB⎦ ⎤
A ⊗ B = [ a 11 b 11 ⋯ a 11 b 1 q ⋯ ⋯ a 1 n b 11 ⋯ a 1 n b 1 q a 11 b 21 ⋯ a 11 b 2 q ⋯ ⋯ a 1 n b 21 ⋯ a 1 n b 2 q ⋮ ⋱ ⋮ ⋮ ⋱ ⋮ a 11 b p 1 ⋯ a 11 b p q ⋯ ⋯ a 1 n b p 1 ⋯ a 1 n b p q ⋮ ⋮ ⋱ ⋮ ⋮ ⋮ ⋮ ⋱ ⋮ ⋮ a m 1 b 11 ⋯ a m 1 b 1 q ⋯ ⋯ a m n b 11 ⋯ a m n b 1 q a m 1 b 21 ⋯ a m 1 b 2 q ⋯ ⋯ a m n b 21 ⋯ a m n b 2 q ⋮ ⋱ ⋮ ⋮ ⋱ ⋮ a m 1 b p 1 ⋯ a m 1 b p q ⋯ ⋯ a m n b p 1 ⋯ a m n b p q ] A\otimes B= \begin{bmatrix} a_{11}b_{11}& \cdots &a_{11}b_{1q}&\cdots&\cdots&a_{1n}b_{11}& \cdots &a_{1n}b_{1q}\\ a_{11}b_{21}& \cdots &a_{11}b_{2q}&\cdots&\cdots&a_{1n}b_{21}& \cdots &a_{1n}b_{2q}\\ \vdots&\ddots&\vdots&&&\vdots&\ddots&\vdots\\ a_{11}b_{p1}& \cdots &a_{11}b_{pq}&\cdots&\cdots&a_{1n}b_{p1}& \cdots &a_{1n}b_{pq}\\ \vdots&&\vdots&\ddots&&\vdots&&\vdots\\ \vdots&&\vdots&&\ddots&\vdots&&\vdots\\ a_{m1}b_{11}& \cdots &a_{m1}b_{1q}&\cdots&\cdots&a_{mn}b_{11}& \cdots &a_{mn}b_{1q}\\ a_{m1}b_{21}& \cdots &a_{m1}b_{2q}&\cdots&\cdots&a_{mn}b_{21}& \cdots &a_{mn}b_{2q}\\ \vdots&\ddots&\vdots&&&\vdots&\ddots&\vdots\\ a_{m1}b_{p1}& \cdots &a_{m1}b_{pq}&\cdots&\cdots&a_{mn}b_{p1}& \cdots &a_{mn}b_{pq}\\ \end{bmatrix} A⊗B=⎣ ⎡a11b11a11b21⋮a11bp1⋮⋮am1b11am1b21⋮am1bp1⋯⋯⋱⋯⋯⋯⋱⋯a11b1qa11b2q⋮a11bpq⋮⋮am1b1qam1b2q⋮am1bpq⋯⋯⋯⋱⋯⋯⋯⋯⋯⋯⋱⋯⋯⋯a1nb11a1nb21⋮a1nbp1⋮⋮amnb11amnb21⋮amnbp1⋯⋯⋱⋯⋯⋯⋱⋯a1nb1qa1nb2q⋮a1nbpq⋮⋮amnb1qamnb2q⋮amnbpq⎦ ⎤
Kronecker product是张量积的特殊形式,具有下列一些性质:
A ⊗ ( B + C ) = A ⊗ B + A ⊗ C ( A + B ) ⊗ C = A ⊗ C + B ⊗ C ( k A ) ⊗ B = k ( A ⊗ B ) ( A ⊗ B ) ⊗ C = A ⊗ ( B ⊗ C ) \begin{aligned} \textbf{A}\otimes(\textbf{B}+\textbf{C})&=\textbf{A}\otimes \textbf{B}+A\otimes \textbf{C}\\ (\textbf{A}+\textbf{B})\otimes \textbf{C}&=\textbf{A}\otimes \textbf{C}+\textbf{B}\otimes \textbf{C}\\ (k\textbf{A})\otimes \textbf{B}&=k(\textbf{A}\otimes \textbf{B})\\ (\textbf{A}\otimes \textbf{B})\otimes \textbf{C}&=\textbf{A}\otimes (\textbf{B}\otimes \textbf{C})\\ \end{aligned} A⊗(B+C)(A+B)⊗C(kA)⊗B(A⊗B)⊗C=A⊗B+A⊗C=A⊗C+B⊗C=k(A⊗B)=A⊗(B⊗C)
但是,该运算并不满足交换律,即:
A ⊗ B ≠ B ⊗ A \textbf{A}\otimes \textbf{B}\neq \textbf{B}\otimes \textbf{A} A⊗B=B⊗A
- Khatri-Rao product
在数学中,Khatri-Rao product被定义为:
A ⊙ B = ( A i j ⊗ B i j ) \textbf{A}\odot\textbf{B}=(\textbf{A}_{ij}\otimes\textbf{B}_{ij}) A⊙B=(Aij⊗Bij)
其中第ij个方块是一个 A \textbf{A} A和 B \textbf{B} B中的小方块的Kronecker product,大小为 m i p i × n j q j m_{i}p_{i}\times n_{j}q_{j} mipi×njqj,当然这里假设 A \textbf{A} A和 B \textbf{B} B两个小方块的横向和纵向的数目相同。
举个例子,假设 A \textbf{A} A和 B \textbf{B} B分别为2×2的分块矩阵:
A = [ A 11 A 12 A 21 A 22 ] = [ 1 2 3 4 5 6 7 8 9 ] \textbf{A}= \begin{bmatrix} \def\arraystretch{1} \begin{array}{c:c} \textbf{A}_{11}&\textbf{A}_{12} \\ \hline \textbf{A}_{21}&\textbf{A}_{22} \\ \end{array} \end{bmatrix} =\begin{bmatrix} \def\arraystretch{1} \begin{array}{cc:c} 1&2&3 \\ 4&5&6\\ \hline 7&8&9\\ \end{array} \end{bmatrix} A=[A11A21A12A22]=⎣ ⎡147258369⎦ ⎤
B = [ B 11 B 12 B 21 B 22 ] = [ 1 4 7 2 5 8 3 6 9 ] \textbf{B}= \begin{bmatrix} \def\arraystretch{1} \begin{array}{c:c} \textbf{B}_{11}&\textbf{B}_{12} \\ \hline \textbf{B}_{21}&\textbf{B}_{22} \\ \end{array} \end{bmatrix} =\begin{bmatrix} \def\arraystretch{1} \begin{array}{c:cc} 1&4&7 \\ \hline 2&5&8\\ 3&6&9\\ \end{array} \end{bmatrix} B=[B11B21B12B22]=⎣ ⎡123456789⎦ ⎤
A ⊙ B = [ A 11 ⊗ B 11 A 12 ⊗ B 12 A 21 ⊗ B 21 A 22 ⊗ B 22 ] = [ 1 2 12 21 4 5 24 42 14 16 45 72 21 24 54 81 ] \textbf{A}\odot\textbf{B}= \begin{bmatrix} \def\arraystretch{1} \begin{array}{c:c} \textbf{A}_{11}\otimes\textbf{B}_{11}&\textbf{A}_{12}\otimes\textbf{B}_{12} \\ \hline \textbf{A}_{21}\otimes\textbf{B}_{21}&\textbf{A}_{22}\otimes\textbf{B}_{22} \\ \end{array} \end{bmatrix} =\begin{bmatrix} \def\arraystretch{1} \begin{array}{cc:cc} 1&2&12&21 \\ 4&5&24&42\\ \hline 14&16&45&72\\ 21&24&54&81\\ \end{array} \end{bmatrix} A⊙B=[A11⊗B11A21⊗B21A12⊗B12A22⊗B22]=⎣ ⎡1414212516241224455421427281⎦ ⎤
值得注意的是,上述为Khartri-Rao的通常形式,其还有其他Column-wise Kronecker product和Face-splitting product两种形式。
- Column-wise Kronecker product
两个矩阵的Column-wise Kronecker product也叫作Khatri-Rao product。这种内积假定了矩阵内的方块被取为矩阵的列。这种情况下, m 1 = m m_{1}=m m1=m, p 1 = p p_{1}=p p1=p, n = q n=q n=q,对于每个 j: n j = p j = 1 n_{j}=p_{j}=1 nj=pj=1。最终的内积是一个mp×n的矩阵,其中的每一列都是 A \textbf{A} A和 B \textbf{B} B各自相应列之间的Kronecker product。举个例子:
C = [ C 1 C 2 C 2 ] = [ 1 2 3 4 5 6 7 8 9 ] \textbf{C}= \begin{bmatrix} \def\arraystretch{1} \begin{array}{c:c:c} \textbf{C}_{1}&\textbf{C}_{2}&\textbf{C}_{2} \\ \end{array} \end{bmatrix} =\begin{bmatrix} \def\arraystretch{1} \begin{array}{c:c:c} 1&2&3 \\ 4&5&6\\ 7&8&9\\ \end{array} \end{bmatrix} C=[C1C2C2]=⎣ ⎡147258369⎦ ⎤
D = [ D 1 D 2 D 3 ] = [ 1 4 7 2 5 8 3 6 9 ] \textbf{D}= \begin{bmatrix} \def\arraystretch{1} \begin{array}{c:c:c} \textbf{D}_{1}&\textbf{D}_{2}&\textbf{D}_{3} \\ \end{array} \end{bmatrix} =\begin{bmatrix} \def\arraystretch{1} \begin{array}{c:c:c} 1&4&7\\ 2&5&8\\ 3&6&9\\ \end{array} \end{bmatrix} D=[D1D2D3]=⎣ ⎡123456789⎦ ⎤
则:
C ⊙ D = [ C 1 ⊗ D 1 C 2 ⊗ D 2 C 3 ⊗ D 3 ] = [ 1 8 21 2 10 24 3 12 27 4 20 42 8 25 48 12 30 54 7 32 63 14 40 72 21 48 81 ] \textbf{C}\odot\textbf{D}= \begin{bmatrix} \def\arraystretch{1} \begin{array}{c:c:c} \textbf{C}_{1}\otimes\textbf{D}_{1}&\textbf{C}_{2}\otimes\textbf{D}_{2}&\textbf{C}_{3}\otimes\textbf{D}_{3} \\ \end{array} \end{bmatrix} =\begin{bmatrix} \def\arraystretch{1} \begin{array}{c:c:c} 1&8&21 \\ 2&10&24 \\ 3&12&27 \\ 4&20&42 \\ 8&25&48 \\ 12&30&54 \\ 7&32&63 \\ 14&40&72 \\ 21&48&81 \\ \end{array} \end{bmatrix} C⊙D=[C1⊗D1C2⊗D2C3⊗D3]=⎣ ⎡12348127142181012202530324048212427424854637281⎦ ⎤
![Logo](https://i-blog.csdnimg.cn/blog_migrate/af440b868f9a0d74c810151f65846a69.png)
Khatri-Rao product的这种column-wise的版本在数据分析处理的线性代数方法和优化处理对角矩阵的逆问题的解决方案中很有用。1996 年,提出了Column-wise Khatri-Rao product来估计多径信号的到达角 (AOA) 和延迟以及数字天线阵列上信号源的四个坐标。
- Face-splitting product
另一种按行分割矩阵的内积,被称为face-splitting product或者transposed Khatri-Rao product。定义如下:
C = [ C 1 C 2 C 2 ] = [ 1 2 3 4 5 6 7 8 9 ] \textbf{C}= \begin{bmatrix} \def\arraystretch{1} \begin{array}{c} \textbf{C}_{1}\\ \hline \textbf{C}_{2}\\ \hline \textbf{C}_{2} \\ \end{array} \end{bmatrix} =\begin{bmatrix} \def\arraystretch{1} \begin{array}{ccc} 1&2&3 \\ \hline 4&5&6\\ \hline 7&8&9\\ \end{array} \end{bmatrix} C=⎣ ⎡C1C2C2⎦ ⎤=⎣ ⎡147258369⎦ ⎤
D = [ D 1 D 2 D 3 ] = [ 1 4 7 2 5 8 3 6 9 ] \textbf{D}= \begin{bmatrix} \def\arraystretch{1} \begin{array}{c} \textbf{D}_{1}\\ \hline \textbf{D}_{2}\\ \hline \textbf{D}_{3} \\ \end{array} \end{bmatrix} =\begin{bmatrix} \def\arraystretch{1} \begin{array}{ccc} 1&4&7\\ \hline 2&5&8\\ \hline 3&6&9\\ \end{array} \end{bmatrix} D=⎣ ⎡D1D2D3⎦ ⎤=⎣ ⎡123456789⎦ ⎤
则:
C ⊙ D = [ C 1 ⊗ D 1 C 2 ⊗ D 2 C 3 ⊗ D 3 ] = [ 1 4 7 2 8 14 3 12 21 8 20 32 10 25 40 12 30 48 21 42 63 24 48 72 27 54 81 ] \textbf{C}\odot\textbf{D}= \begin{bmatrix} \def\arraystretch{1} \begin{array}{c} \textbf{C}_{1}\otimes\textbf{D}_{1}\\ \hline \textbf{C}_{2}\otimes\textbf{D}_{2}\\ \hline \textbf{C}_{3}\otimes\textbf{D}_{3} \\ \end{array} \end{bmatrix} =\begin{bmatrix} \def\arraystretch{1} \begin{array}{ccccccccc} 1&4&7&2&8&14&3&12&21 \\ \hline 8&20&32&10&25&40&12&30&48 \\ \hline 21&42&63&24&48&72&27&54&81 \\ \end{array} \end{bmatrix} C⊙D=⎣ ⎡C1⊗D1C2⊗D2C3⊗D3⎦ ⎤=⎣ ⎡18214204273263210248254814407231227123054214881⎦ ⎤
- N-way tensor
N-way tensor 即Nth order tensor,即其维度为:
I 1 × I 2 ⋯ × I N I_{1}\times I_{2}\cdots\times I_{N} I1×I2⋯×IN
其第 i = ( i 1 , i 2 , ⋯ , i N ) \textbf{i}=(i_{1},i_{2},\cdots,i_{N}) i=(i1,i2,⋯,iN)个元素可以表示为 a i a_{\textbf{i}} ai。
- Frobenius norm(F-范数)
给定一个张量 A \mathcal{A} A为 A ( : , : , 1 ) = [ 1 2 3 4 ] \mathcal{A}(:,:,1)=\begin{bmatrix}1&2\\3&4\end{bmatrix} A(:,:,1)=[1324], A ( : , : , 2 ) = [ 5 6 7 8 ] \mathcal{A}(:,:,2)=\begin{bmatrix}5&6\\7&8\end{bmatrix} A(:,:,2)=[5768],则该张量的F-范数为:
∥ A ∥ F = < A , A > = 1 2 + 2 2 + 3 2 + 4 2 + 5 2 + 6 2 + 7 2 + 8 2 = 204 \lVert\mathcal{A}\rVert_{F}=\sqrt{\left<\mathcal{A},\mathcal{A}\right>}=\sqrt{1^{2}+2^{2}+3^{2}+4^{2}+5^{2}+6^{2}+7^{2}+8^{2}}=\sqrt{204} ∥A∥F=⟨A,A⟩=12+22+32+42+52+62+72+82=204
即张量 A \mathcal{A} A的F-范数的平方等于其所有元素的平方和,正是这样,很多涉及到矩阵分解或张量分解的优化问题中常常会出现残差矩阵的平方和最小化或者残差张量的平方和最小化,目标函数也多以相应的残差矩阵或残差张量的F-范数的平方形式进行书写。
- tensor unfolding(张量展开)
在实际应用中,由于高阶张量比向量、矩阵都抽象,最简单地,向量和矩阵可以很轻松地书写出来并进行运算,而高阶张量则不那么直观,如何将高阶张量转换成二维空间的矩阵呢?这就是张量的展开,有时,也将张量的展开称为张量的矩阵化(Matricization: transforming a tensor into a matrix)。文中的mode-n matricization或者unfolding of a tensor即是说得这件事情。
下面举例介绍一下:
给定大小为4×3×2的张量
A
\mathcal{A}
A,其中,矩阵
A
(
:
,
:
,
1
)
=
[
a
111
a
121
a
131
a
211
a
221
a
231
a
311
a
321
a
331
a
411
a
421
a
431
]
\mathcal{A}(:,:,1)=\begin{bmatrix}a_{111}&a_{121}&a_{131}\\a_{211}&a_{221}&a_{231}\\a_{311}&a_{321}&a_{331}\\a_{411}&a_{421}&a_{431}\end{bmatrix}
A(:,:,1)=⎣
⎡a111a211a311a411a121a221a321a421a131a231a331a431⎦
⎤,矩阵
A
(
:
,
:
,
2
)
=
[
a
112
a
122
a
132
a
212
a
222
a
232
a
312
a
322
a
332
a
412
a
422
a
432
]
\mathcal{A}(:,:,2)=\begin{bmatrix}a_{112}&a_{122}&a_{132}\\a_{212}&a_{222}&a_{232}\\a_{312}&a_{322}&a_{332}\\a_{412}&a_{422}&a_{432}\end{bmatrix}
A(:,:,2)=⎣
⎡a112a212a312a412a122a222a322a422a132a232a332a432⎦
⎤,按照mode-1(即对应着张量的第一阶,沿着行方向)展开可以得到:
A ( 1 ) = [ a 111 a 121 a 131 a 112 a 122 a 132 a 211 a 221 a 231 a 212 a 222 a 232 a 311 a 321 a 331 a 312 a 322 a 332 a 411 a 421 a 431 a 412 a 422 a 432 ] \mathcal{A}_{(1)}= \begin{bmatrix} a_{111}&a_{121}&a_{131}&a_{112}&a_{122}&a_{132}\\ a_{211}&a_{221}&a_{231}&a_{212}&a_{222}&a_{232}\\ a_{311}&a_{321}&a_{331}&a_{312}&a_{322}&a_{332}\\ a_{411}&a_{421}&a_{431}&a_{412}&a_{422}&a_{432}\\ \end{bmatrix} A(1)=⎣ ⎡a111a211a311a411a121a221a321a421a131a231a331a431a112a212a312a412a122a222a322a422a132a232a332a432⎦ ⎤
即矩阵 A ( 1 ) = [ A ( : , : , 1 ) , A ( : , : , 2 ) ] \mathcal{A}_{(1)}=\left[\mathcal{A}(:,:,1),\mathcal{A}(:,:,2)\right] A(1)=[A(:,:,1),A(:,:,2)],其大小为4×6。
按照mode-2(即对应着张量的第二阶,沿列展开)展开可以得到:
A ( 2 ) = [ a 111 a 211 a 311 a 411 a 112 a 212 a 312 a 412 a 121 a 221 a 321 a 421 a 122 a 222 a 322 a 422 a 131 a 231 a 331 a 431 a 132 a 232 a 332 a 432 ] \mathcal{A}_{(2)}= \begin{bmatrix} a_{111}&a_{211}&a_{311}&a_{411}&a_{112}&a_{212}&a_{312}&a_{412}\\ a_{121}&a_{221}&a_{321}&a_{421}&a_{122}&a_{222}&a_{322}&a_{422}\\ a_{131}&a_{231}&a_{331}&a_{431}&a_{132}&a_{232}&a_{332}&a_{432}\\ \end{bmatrix} A(2)=⎣ ⎡a111a121a131a211a221a231a311a321a331a411a421a431a112a122a132a212a222a232a312a322a332a412a422a432⎦ ⎤
即矩阵 A ( 2 ) = [ A ( : , : , 1 ) T , A ( : , : , 2 ) T ] \mathcal{A}_{(2)}=\left[\mathcal{A}(:,:,1)^{T},\mathcal{A}(:,:,2)^{T}\right] A(2)=[A(:,:,1)T,A(:,:,2)T],其大小为3×8。
按照mode-3(即对应着张量的第三阶,沿纵深展开)展开可以得到:
A ( 3 ) = [ a 111 a 211 a 311 a 411 a 121 a 221 a 321 a 421 a 131 a 231 a 331 a 431 a 112 a 212 a 312 a 412 a 122 a 222 a 322 a 422 a 132 a 232 a 332 a 432 ] \mathcal{A}_{(3)}= \begin{bmatrix} a_{111}&a_{211}&a_{311}&a_{411}&a_{121}&a_{221}&a_{321}&a_{421}&a_{131}&a_{231}&a_{331}&a_{431}\\ a_{112}&a_{212}&a_{312}&a_{412}&a_{122}&a_{222}&a_{322}&a_{422}&a_{132}&a_{232}&a_{332}&a_{432}\\ \end{bmatrix} A(3)=[a111a112a211a212a311a312a411a412a121a122a221a222a321a322a421a422a131a132a231a232a331a332a431a432]
即矩阵 A ( 3 ) = [ A ( : , 1 , : ) T , A ( : , 2 , : ) T , A ( : , 3 , : ) T ] \mathcal{A}_{(3)}=\left[\mathcal{A}(:,1,:)^{T},\mathcal{A}(:,2,:)^{T},\mathcal{A}(:,3,:)^{T}\right] A(3)=[A(:,1,:)T,A(:,2,:)T,A(:,3,:)T],其大小为2×12。
类似地,如果给定一个大小为2×2×2×2的第四阶张量 A \mathcal{A} A,则在各个mode(模态)下的开展分别为:
A ( 1 ) = [ A ( : , : , 1 , 1 ) , A ( : , : , 2 , 1 ) , A ( : , : , 1 , 2 ) , A ( : , : , 2 , 2 ) ] , A ( 2 ) = [ A ( : , : , 1 , 1 ) T , A ( : , : , 2 , 1 ) T , A ( : , : , 1 , 2 ) T , A ( : , : , 2 , 2 ) T ] , A ( 3 ) = [ A ( : , 1 , : , 1 ) T , A ( : , 2 , : , 1 ) T , A ( : , 1 , : , 2 ) T , A ( : , 2 , : , 2 ) T ] , A ( 4 ) = [ A ( : , 1 , 1 , : ) T , A ( : , 2 , 1 , : ) T , A ( : , 1 , 2 , : ) T , A ( : , 2 , 2 , : ) T ] , \begin{aligned} \mathcal{A}_{(1)}&=\left[\mathcal{A}(:,:,1,1),\mathcal{A}(:,:,2,1),\mathcal{A}(:,:,1,2),\mathcal{A}(:,:,2,2)\right],\\ \mathcal{A}_{(2)}&=\left[\mathcal{A}(:,:,1,1)^{T},\mathcal{A}(:,:,2,1)^{T},\mathcal{A}(:,:,1,2)^{T},\mathcal{A}(:,:,2,2)^{T}\right],\\ \mathcal{A}_{(3)}&=\left[\mathcal{A}(:,1,:,1)^{T},\mathcal{A}(:,2,:,1)^{T},\mathcal{A}(:,1,:,2)^{T},\mathcal{A}(:,2,:,2)^{T}\right],\\ \mathcal{A}_{(4)}&=\left[\mathcal{A}(:,1,1,:)^{T},\mathcal{A}(:,2,1,:)^{T},\mathcal{A}(:,1,2,:)^{T},\mathcal{A}(:,2,2,:)^{T}\right],\\ \end{aligned} A(1)A(2)A(3)A(4)=[A(:,:,1,1),A(:,:,2,1),A(:,:,1,2),A(:,:,2,2)],=[A(:,:,1,1)T,A(:,:,2,1)T,A(:,:,1,2)T,A(:,:,2,2)T],=[A(:,1,:,1)T,A(:,2,:,1)T,A(:,1,:,2)T,A(:,2,:,2)T],=[A(:,1,1,:)T,A(:,2,1,:)T,A(:,1,2,:)T,A(:,2,2,:)T],
举个例子,若 A ( : , : , 1 , 1 ) = [ 1 2 3 4 ] \mathcal{A}(:,:,1,1)=\begin{bmatrix}1&2\\3&4\end{bmatrix} A(:,:,1,1)=[1324], A ( : , : , 2 , 1 ) = [ 5 6 7 8 ] \mathcal{A}(:,:,2,1)=\begin{bmatrix}5&6\\7&8\end{bmatrix} A(:,:,2,1)=[5768], A ( : , : , 1 , 2 ) = [ 9 10 11 12 ] \mathcal{A}(:,:,1,2)=\begin{bmatrix}9&10\\11&12\end{bmatrix} A(:,:,1,2)=[9111012], A ( : , : , 2 , 2 ) = [ 13 14 15 16 ] \mathcal{A}(:,:,2,2)=\begin{bmatrix}13&14\\15&16\end{bmatrix} A(:,:,2,2)=[13151416],则:
A ( 1 ) = [ 1 2 5 6 9 10 13 14 3 4 7 8 11 12 15 16 ] \mathcal{A}_{(1)}= \begin{bmatrix} 1&2&5&6&9&10&13&14\\ 3&4&7&8&11&12&15&16\\ \end{bmatrix} A(1)=[13245768911101213151416]
A ( 2 ) = [ 1 3 5 7 9 11 13 15 2 4 6 8 10 12 14 16 ] \mathcal{A}_{(2)}= \begin{bmatrix} 1&3&5&7&9&11&13&15\\ 2&4&6&8&10&12&14&16\\ \end{bmatrix} A(2)=[12345678910111213141516]
A ( 3 ) = [ 1 3 2 4 9 11 10 12 5 7 6 8 13 15 14 16 ] \mathcal{A}_{(3)}= \begin{bmatrix} 1&3&2&4&9&11&10&12\\ 5&7&6&8&13&15&14&16\\ \end{bmatrix} A(3)=[15372648913111510141216]
A ( 4 ) = [ 1 3 2 4 5 7 6 8 9 11 10 12 13 15 14 16 ] \mathcal{A}_{(4)}= \begin{bmatrix} 1&3&2&4&5&7&6&8\\ 9&11&10&12&13&15&14&16\\ \end{bmatrix} A(4)=[19311210412513715614816]
可惜的是,张量的展开虽然有一定的规则,但并没有很强的物理意义,对高阶张量进行展开会方便使用相应的矩阵化运算。除此之外,高阶张量可以展开自然也就可以还原(即将展开后的矩阵还原成高阶张量,这个过程成为folding)。
现在回看文中的 mA ( n ) \textbf{mA}_{(n)} mA(n)中的 m \textbf{m} m指的是matricization, A \textbf{A} A指的是张量名字,n指的是mode的序号。
- outer product(外积)
给定两个向量 u \textbf{u} u和 u \textbf{u} u,大小分别为m×1和n×1:
u = [ u 1 u 2 ⋮ u m ] , v = [ v 1 v 2 ⋮ v n ] \textbf{u}= \begin{bmatrix} u_{1}\\ u_{2}\\ \vdots\\ u_{m}\\ \end{bmatrix}, \textbf{v}= \begin{bmatrix} v_{1}\\ v_{2}\\ \vdots\\ v_{n}\\ \end{bmatrix} u=⎣ ⎡u1u2⋮um⎦ ⎤,v=⎣ ⎡v1v2⋮vn⎦ ⎤
则它们的外积被定义为:
u ∘ v = [ u 1 v 1 u 1 v 2 ⋯ u 1 v n u 2 v 1 u 2 v 2 ⋯ u 2 v n ⋮ ⋮ ⋱ ⋮ u m v 1 u m v 2 ⋯ u m v n ] \textbf{u}\circ\textbf{v}= \begin{bmatrix} u_{1}v_{1}&u_{1}v_{2}&\cdots&u_{1}v_{n}\\ u_{2}v_{1}&u_{2}v_{2}&\cdots&u_{2}v_{n}\\ \vdots&\vdots&\ddots&\vdots\\ u_{m}v_{1}&u_{m}v_{2}&\cdots&u_{m}v_{n}\\ \end{bmatrix} u∘v=⎣ ⎡u1v1u2v1⋮umv1u1v2u2v2⋮umv2⋯⋯⋱⋯u1vnu2vn⋮umvn⎦ ⎤
可以简写为:
( u ∘ v ) i j = u i v j (\textbf{u}\circ\textbf{v})_{ij}=u_{i}v_{j} (u∘v)ij=uivj
由上可以看出,向量的外积等于其相应矩阵的乘积,即:
u ∘ v = u v T \textbf{u}\circ\textbf{v}=\textbf{u}\textbf{v}^{T} u∘v=uvT
将向量的内积拓展到张量上:
给定两个张量
U
\mathcal{U}
U和
V
\mathcal{V}
V,其维度分别为
(
k
1
,
k
2
,
⋯
,
k
m
)
(k_{1},k_{2},\cdots,k_{m})
(k1,k2,⋯,km)和
(
l
1
,
l
2
,
⋯
,
l
n
)
(l_{1},l_{2},\cdots,l_{n})
(l1,l2,⋯,ln),它们的外积:
( U ∘ V ) i 1 , i 2 , ⋯ , i m , j 1 , j 2 , ⋯ , j n = u i 1 , i 2 , ⋯ , i m v j 1 , j 2 , ⋯ , j n (\mathcal{U}\circ\mathcal{V})_{i_{1},i_{2},\cdots,i_{m},j_{1},j_{2},\cdots,j_{n}}=u_{i_{1},i_{2},\cdots,i_{m}}v_{j_{1},j_{2},\cdots,j_{n}} (U∘V)i1,i2,⋯,im,j1,j2,⋯,jn=ui1,i2,⋯,imvj1,j2,⋯,jn
- inner product(内积)
给定两个向量 u \textbf{u} u和 u \textbf{u} u,大小分别为m×1和n×1,则其内积为:
< u , v > = ∑ i u i v i \left<\textbf{u},\textbf{v}\right>=\sum_{i}u_{i}v_{i} ⟨u,v⟩=i∑uivi
给定两个张量 u \mathcal{u} u和 u \mathcal{u} u,则其内积为:
< U , V > = ∑ i u i v i \left<\mathcal{U},\mathcal{V}\right>=\sum_{i}u_{i}v_{i} ⟨U,V⟩=i∑uivi
由于两个大小相同的张量其内积是一个标量,所以也常把内积叫做标量积(scalar product)。
- Trucker decomposition
就高阶奇异值分解而言,著名学者Tucker于1966年给出了计算Tucker分解的三种方法,第一种方法就是我们这里要提到的高阶奇异值分解,其整个分解过程也是由矩阵的奇异值分解泛化得到的。
CP decomposition(CANDECOMP/PARAFAC)表示parallel factors analysis(PARAFAC,平行因子分析)和canonical decomposition(CANDECOMP,规范分解)。
在文中,用 M \mathcal{M} M表示一个N阶张量(大小为 I 1 × I 2 × ⋯ × I N I_{1}\times I_{2}\times\cdots\times I_{N} I1×I2×⋯×IN)。利用R-component CANDECOMP/PARAFAC(CP)factor model可以将其分解为:
M = ∑ r = 1 R λ r ma r ( 1 ) ∘ ⋯ ∘ ma r ( N ) \mathcal{M}=\sum_{r=1}^{R}\lambda_{r}\textbf{ma}_{r}^{(1)}\circ\cdots\circ\textbf{ma}_{r}^{(N)} M=r=1∑Rλrmar(1)∘⋯∘mar(N)
其中R可以根据实际情况设定,如文中取 R = 2 R=2 R=2,即每阶提取两个因子(component或者mode,即每个r所代表的和式为一个component), ∘ \circ ∘代表外积, ma r ( n ) \textbf{ma}_{r}^{(n)} mar(n)代表factor matrix mA ( n ) \textbf{mA}^{(n)} mA(n)的第r列,大小为 I n × R I_{n}\times R In×R。
相关资料:
Matrix computations by Gene H.Golub
Tensor decompositions and Applications by Tamara G. Kolda