自学脚手架——“Data-Driven Science and Engineering” by steven L. brunton(Chapter 1.9)

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= a11am1a1namn

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= b11ap1b1qapq

则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} AB= a11Bam1Ba1nBamnB

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} AB= a11b11a11b21a11bp1am1b11am1b21am1bp1a11b1qa11b2qa11bpqam1b1qam1b2qam1bpqa1nb11a1nb21a1nbp1amnb11amnb21amnbp1a1nb1qa1nb2qa1nbpqamnb1qamnb2qamnbpq

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(AB)C=AB+AC=AC+BC=k(AB)=A(BC)

但是,该运算并不满足交换律,即:

A ⊗ B ≠ B ⊗ A \textbf{A}\otimes \textbf{B}\neq \textbf{B}\otimes \textbf{A} AB=BA

  • 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}) AB=(AijBij)

其中第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} AB=[A11B11A21B21A12B12A22B22]= 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} CD=[C1D1C2D2C3D3]= 12348127142181012202530324048212427424854637281

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} CD= C1D1C2D2C3D3 = 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} AF=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= u1u2um ,v= v1v2vn

则它们的外积被定义为:

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} uv= u1v1u2v1umv1u1v2u2v2umv2u1vnu2vnumvn

可以简写为:

( u ∘ v ) i j = u i v j (\textbf{u}\circ\textbf{v})_{ij}=u_{i}v_{j} (uv)ij=uivj

由上可以看出,向量的外积等于其相应矩阵的乘积,即:

u ∘ v = u v T \textbf{u}\circ\textbf{v}=\textbf{u}\textbf{v}^{T} uv=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}} (UV)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=iuivi

给定两个张量 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=iuivi

由于两个大小相同的张量其内积是一个标量,所以也常把内积叫做标量积(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=1Rλ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

相关资料:

Kronecker product

Khartri-Rao product

Matrix computations by Gene H.Golub

Tensor decompositions and Applications by Tamara G. Kolda

浅谈张量分解(二):张量分解的数学基础

Tucker decomposition

Higher-order singular value decomposition

Tensor rank decomposition

Multilinear algebra

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在风能领域,准确预测风速对于风电场的运行与管理至关重要。Matlab作为一个强大的数学计算和数据分析平台,被广泛应用于风速预测模型的构建。本文将深入探讨基于四种风速——随机风、基本风、阵风和渐变风的组合风速预测技术。 我们来理解这四种风速类型: 1. **随机风**:随机风是指风速呈现出随机性的变化,通常由大气湍流引起。在建模中,通常通过统计方法如高斯分布或Weibull分布来模拟这种不确定性。 2. **基本风**:基本风速是指在无特定扰动条件下的平均风速,它是长期观测结果的平均值,通常用于结构设计和风能评估。 3. **阵风**:阵风是短时间内风速显著增强的现象,对建筑物和风力发电机造成的主要威胁之一。阵风的预测涉及到风的脉动特性分析。 4. **渐变风**:渐变风是指风速随时间和空间逐渐变化的过程,常见于风向转变或地形影响下的风场变化。 在Matlab中,利用这四种风速类型进行组合预测,可以提高预测的准确性。预测模型可能包括以下几个步骤: 1. **数据收集与预处理**:收集历史风速数据,包括随机风、基本风、阵风和渐变风的数据,进行异常值检测、缺失值填充以及数据标准化。 2. **特征工程**:提取风速变化的相关特征,如平均值、标准差、极值、频率分布等,这些特征可能对预测有重要影响。 3. **模型选择**:可以选择多种预测模型,如时间序列分析(ARIMA、状态空间模型等)、机器学习算法(线性回归、决策树、支持向量机、神经网络等)或深度学习模型(LSTM、GRU等)。 4. **模型训练**:利用历史数据训练选定的模型,调整模型参数以优化性能,例如通过交叉验证来避免过拟合。 5. **模型验证与评估**:使用独立的测试集验证模型预测效果,常见的评估指标有均方误差(MSE)、平均绝对误差(MAE)和决定系数(R²)。 6. **组合预测**:结合四种风速的不同模型预测结果,可以采用加权平均、集成学习(如bagging、boosting)等方式,以提升整体预测精度。 7. **实时更新与动态调整**:实际应用中,模型需要不断接收新的风速数据并进行在线更新,以适应风场环境的变化。 通过以上步骤,可以构建一个综合考虑各种风速特性的预测系统,这对于风电场的功率输出预测、风电设备的维护计划以及电网调度都具有重要价值。然而,需要注意的是,每个风场的地理环境、气候条件和设备状况都有所不同,因此模型的建立应根据实际情况进行定制和优
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值