48 篇文章 6 订阅

# 从谱聚类说起

L = D − A L=D-A

D是一个对角矩阵，每个对角元素 D i i \displaystyle D_{ii} 表示第i个结点的度。A则是这个图邻接矩阵。为什么要这样去构造一个矩阵呢？因为研究图的一些性质的时候，我们常常用到一个类似于下式的目标函数：

x T M x = ∑ { u , v } ∈ E ( x u − x v ) 2 \mathbf{x^{T}} M\mathbf{x} =\sum _{\{u,v\} \in E}( x_{u} -x_{v})^{2}

min ⁡ ∑ { u , v } ∈ E ( x u − x v ) 2 = ∑ u ∈ A , v ∉ A ‾ ( 1 − 0 ) 2 + ∑ u ∈ A , v ∉ A ‾ ( 0 − 1 ) 2 = 2 c u t ( A , A ‾ ) \min\sum _{\{u,v\} \in E}( x_{u} -x_{v})^{2} =\sum _{u\in A,v\not{\in }\overline{A}}( 1-0)^{2} +\sum _{u\in A,v\not{\in }\overline{A}}( 0-1)^{2} =2cut\left( A,\overline{A}\right)

x T ( d I − A ) x = d x T x − x T A x = ∑ v d x v 2 − 2 ∑ { u , v } ∈ E x u x v = ∑ { u , v } ∈ E ( x u − x v ) 2 \mathbf{x}^{T}( dI-A)\mathbf{x} =d\mathbf{x}^{T}\mathbf{x} -\mathbf{x}^{T} A\mathbf{x} =\sum _{v} dx^{2}_{v} -2\sum _{\{u,v\} \in E} x_{u} x_{v} =\sum _{\{u,v\} \in E}( x_{u} -x_{v})^{2}

x T L x = x T ( d I − W ) x = ∑ i , j ω i j ( x u − x v ) 2 x^{T} Lx\mathbf{=x}^{T}( dI-W)\mathbf{x} =\sum _{i,j} \omega _{ij}( x_{u} -x_{v})^{2}

## RatioCut 切图聚类

RatioCut考虑最小化 c u t ( A 1 , A 2 , . . . , A k ) \displaystyle cut( A_{1} ,A_{2} ,...,A_{k}) ，同时最大化每个子图的个数即：

R a t i o C u t ( A 1 , A 2 , . . . A k ) = 1 2 ∑ i = 1 k c u t ( A i , A ‾ i ) ∣ A i ∣ RatioCut(A_{1} ,A_{2} ,...A_{k} )=\frac{1}{2}\sum\limits ^{k}_{i=1}\frac{cut(A_{i} ,\overline{A}_{i} )}{|A_{i} |}

c u t ( A i , A ‾ i ) = ∑ i ∈ A , j ∈ A ‾ i w i j cut(A_{i} ,\overline{A}_{i} )=\sum\limits _{i\in A,j\in \overline{A}_{i}} w_{ij}

h i j = { 0 v j ∉ A i 1 ∣ A i ∣ v j ∈ A i h_{ij} =\begin{cases} 0 & v_{j} \notin A_{i}\\ \frac{1}{\sqrt{|A_{i} |}} & v_{j} \in A_{i} \end{cases}

h i T L h i = 1 2 ∑ m = 1 ∣ V ∣ ∑ n = 1 ∣ V ∣ w m n ( h i m − h i n ) 2 = 1 2 ( ∑ m ∈ A i , n ∉ A i w m n ( 1 ∣ A i ∣ − 0 ) 2 + ∑ m ∉ A i , n ∈ A i w m n ( 0 − 1 ∣ A i ∣ ) 2 = 1 2 ( ∑ m ∈ A i , n ∉ A i w m n 1 ∣ A i ∣ + ∑ m ∉ A i , n ∈ A i w m n 1 ∣ A i ∣ = 1 2 ( c u t ( A i , A ‾ i ) 1 ∣ A i ∣ + c u t ( A ‾ i , A i ) 1 ∣ A i ∣ ) = c u t ( A i , A ‾ i ) ∣ A i ∣ \begin{aligned} h^{T}_{i} Lh_{i} & =\frac{1}{2}\sum\limits ^{|V|}_{m=1}\sum\limits ^{|V|}_{n=1} w_{mn} (h_{im} -h_{in} )^{2}\\ & =\frac{1}{2} (\sum\limits _{m\in A_{i} ,n\notin A_{i}} w_{mn} (\frac{1}{\sqrt{|A_{i} |}} -0)^{2} +\sum\limits _{m\notin A_{i} ,n\in A_{i}} w_{mn} (0-\frac{1}{\sqrt{|A_{i} |}} )^{2}\\ & =\frac{1}{2} (\sum\limits _{m\in A_{i} ,n\notin A_{i}} w_{mn}\frac{1}{|A_{i} |} +\sum\limits _{m\notin A_{i} ,n\in A_{i}} w_{mn}\frac{1}{|A_{i} |}\\ & =\frac{1}{2} (cut(A_{i} ,\overline{A}_{i} )\frac{1}{|A_{i} |} +cut(\overline{A}_{i} ,A_{i} )\frac{1}{|A_{i} |} )\\ & =\frac{cut(A_{i} ,\overline{A}_{i} )}{|A_{i} |} \end{aligned}

R a t i o C u t ( A 1 , A 2 , . . . A k ) = ∑ i = 1 k h i T L h i = ∑ i = 1 k ( H T L H ) i i = t r ( H T L H ) s . t .   h i T h i = 1 ,   i = 1 , 2 , . . . , k RatioCut(A_{1} ,A_{2} ,...A_{k} )=\sum\limits ^{k}_{i=1} h^{T}_{i} Lh_{i} =\sum\limits ^{k}_{i=1} (H^{T} LH)_{ii} =tr(H^{T} LH)\\ s.t.\ h^{T}_{i} h_{i} =1,\ i=1,2,...,k

∇ h ( h T L h − λ ( 1 − h T h ) ) = ∇ h t r ( h T L h − λ ( 1 − h T h ) ) = ∇ h t r ( h T L h ) − λ ∇ h t r ( h h T ) = ∇ h t r ( h h T L ) − λ ∇ h t r ( h E h T E ) = ∇ h t r ( h E h T L ) − λ ∇ h t r ( h E h T E ) = L h + L T h − λ ( h + h ) = 2 L h − 2 λ h = 0 ⟹ L u = λ h \begin{aligned} \nabla _{h}\left( h^{T} Lh-\lambda \left( 1-h^{T} h\right)\right) & =\nabla _{h} tr\left( h^{T} Lh-\lambda \left( 1-h^{T} h\right)\right)\\ & =\nabla _{h} tr\left( h^{T} Lh\right) -\lambda \nabla _{h} tr\left( hh^{T}\right)\\ & =\nabla _{h} tr(hh^{T} L)-\lambda \nabla _{h} tr(hEh^{T} E)\\ & =\nabla _{h} tr(hEh^{T} L)-\lambda \nabla _{h} tr(hEh^{T} E)\\ & =Lh+L^{T} h-\lambda ( h+h)\\ & =2Lh-2\lambda h\\ & =0\\ & \Longrightarrow Lu=\lambda h \end{aligned}

h i j ∗ = h i j ( ∑ t = 1 k h i t 2 ) 1 / 2 h^{*}_{ij} =\frac{h_{ij}}{(\sum\limits ^{k}_{t=1} h^{2}_{it} )^{1/2}}

1. 计算标准化后的lapace矩阵
2. 求解标准化lapace矩阵的特征值与特征向量
3. 取最小的k1个特征向量,及其对应的特征向量f
4. 将f排列成一个n*k1的矩阵，对矩阵的每一行进行标准化，然后使用k means聚类，聚类数为k2
5. 得到k2个簇，就是对应k2个划分。

# GCN

## 傅里叶级数的直观意义

### 傅里叶变换推导

f ( x ) = C + ∑ n = 1 ∞ ( a n c o s ( 2 π n T x ) + b n s i n ( 2 π n T x ) ) , C ∈ R {\displaystyle f(x)=C+\sum ^{\infty }_{n=1}\left( a_{n} cos(\frac{2\pi n}{T} x)+b_{n} sin(\frac{2\pi n}{T} x)\right) ,C\in \mathbb{R}}

a n = ∫ − T / 2 T / 2 f ( x ) c o s ( 2 π n T x ) d x ∫ − T / 2 T / 2 c o s 2 ( 2 π n T x ) d x = 2 T ∫ − T / 2 T / 2 f ( x ) c o s ( 2 π n T x ) d x b n = ∫ − T / 2 T / 2 f ( x ) s i n ( 2 π n T x ) d x ∫ − T / 2 T / 2 s i n 2 ( 2 π n T x ) d x = 2 T ∫ − T / 2 T / 2 f ( x ) s i n ( 2 π n T x ) d x a_{n} =\frac{\int ^{T/2}_{-T/2} f(x)cos(\frac{2\pi n}{T} x)dx}{\int ^{T/2}_{-T/2} cos^{2} (\frac{2\pi n}{T} x)dx} =\frac{2}{T}\int ^{T/2}_{-T/2} f(x)cos(\frac{2\pi n}{T} x)dx\\ b_{n} =\frac{\int ^{T/2}_{-T/2} f(x)sin(\frac{2\pi n}{T} x)dx}{\int ^{T/2}_{-T/2} sin^{2} (\frac{2\pi n}{T} x)dx} =\frac{2}{T}\int ^{T/2}_{-T/2} f(x)sin(\frac{2\pi n}{T} x)dx

cos ⁡ x = e i x + e − i x 2 , sin ⁡ x = e i x − e − i x 2 i ， {\displaystyle \cos x=\frac{e^{ix} +e^{-ix}}{2} ,\sin x=\frac{e^{ix} -e^{-ix}}{2i} ，}

a n cos ⁡ ( 2 π n T x ) + b n sin ⁡ ( 2 π n T x ) = a n ( e i 2 π n T x + e − i 2 π n T x 2 ) + b k ( e i 2 π n T x − e − i 2 π n T x 2 i ) = ( a n − i b n 2 ) e i 2 π n T x + ( a n + i b n 2 ) e − i 2 π n T x = c n e i 2 π n T x + c − n e − i 2 π n T x \begin{aligned} a_{n}\cos (\frac{2\pi n}{T} x)+b_{n}\sin (\frac{2\pi n}{T} x) & =a_{n}\left(\frac{e^{i\frac{2\pi n}{T} x} +e^{-i\frac{2\pi n}{T} x}}{2}\right)+b_{k}\left(\frac{e^{i\frac{2\pi n}{T} x} -e^{-i\frac{2\pi n}{T} x}}{2i}\right)\\ & =\left(\frac{a_{n} -ib_{n}}{2}\right) e^{i\frac{2\pi n}{T} x} +\left(\frac{a_{n} +ib_{n}}{2}\right) e^{-i\frac{2\pi n}{T} x}\\ & =c_{n} e^{i\frac{2\pi n}{T} x} +c_{-n} e^{-i\frac{2\pi n}{T} x} \end{aligned}

f ( x ) = ∑ n = − ∞ ∞ c n ⏟ 基 的 坐 标 ⋅ e i 2 π n x T ⏟ 正 交 基 {\displaystyle f(x)=\sum ^{\infty }_{n=-\infty }\underbrace{c_{n}}_{基的坐标} \cdot \underbrace{e^{i\tfrac{2\pi nx}{T}}}_{正交基}}

c n = 1 T ∫ − T / 2 T / 2 f ( x ) ( cos ⁡ ( 2 π n T x ) − i sin ⁡ ( 2 π n T x ) ) d x = 1 T ∫ − T / 2 T / 2 f ( x ) e − i 2 π n T x d x c_{n} =\frac{1}{T}\int ^{T/2}_{-T/2} f(x)(\cos (\frac{2\pi n}{T} x)-i\sin (\frac{2\pi n}{T} x))dx=\frac{1}{T}\int ^{T/2}_{-T/2} f(x)e^{-i \frac{2\pi n}{T}} x dx

f ( x ) = ∑ n = − ∞ ∞ Δ ω 2 π ∫ − T / 2 T / 2 f ( x ) e − i ω n x d x ⋅ e i ω n x {\displaystyle f(x)=\sum ^{\infty }_{n=-\infty }\frac{\Delta \omega }{2\pi }\int ^{T/2}_{-T/2} f(x)e^{-i\omega _{n} x} dx\cdot } e^{i\omega _{n} x}

f ( x ) = ∑ n = − ∞ ∞ Δ ω 2 π F ( ω n ) ⋅ e i ω n x = 1 2 π ∑ n = − ∞ ∞ F ( ω n ) ⋅ e i ω n x Δ ω = 1 2 π ∫ − ∞ + ∞ F ( ω ) ⋅ e i ω x d ω \begin{aligned} {\displaystyle f(x)} & ={\displaystyle \sum ^{\infty }_{n=-\infty }\frac{\Delta \omega }{2\pi } F( \omega _{n}) \cdot } e^{i\omega _{n} x}\\ & ={\displaystyle \frac{1}{2\pi }\sum ^{\infty }_{n=-\infty } F( \omega _{n}) \cdot } e^{i\omega _{n} x} \Delta \omega \\ & ={\displaystyle \frac{1}{2\pi }\int ^{+\infty }_{-\infty } F( \omega ) \cdot } e^{i\omega x} d\omega \end{aligned}

F ( ω ) = ∫ − ∞ + ∞ f ( x ) e − i ω x d x {\displaystyle F( \omega ) =\int ^{+\infty }_{-\infty } f(x)e^{-i\omega x} dx}

## 图上的傅里叶变换

f ^ ( ξ ) : = < f , e 2 π i ξ t > = ∫ R f ( t ) e − 2 π i ξ t d t \hat{f} (\xi ):=\left< f,e^{2\pi i\xi t}\right> =\int _{\mathbb{R}} f(t)e^{-2\pi i\xi t} dt

− Δ ( e 2 π i ξ t ) = − ∂ 2 ∂ t 2 e 2 π i ξ t = ( 2 π ξ ) 2 e 2 π i ξ t -\Delta \left( e^{2\pi i\xi t}\right) =-\frac{\partial ^{2}}{\partial t^{2}} e^{2\pi i\xi t} =(2\pi \xi )^{2} e^{2\pi i\xi t}

f ^ ( λ l ) : = < f , u l > = ∑ i = 1 N f ( i ) u l ∗ ( i ) \hat{f}( \lambda _{l}) :=< \mathbf{f} ,\mathbf{u}_{l}> =\sum ^{N}_{i=1} f(i)u^{*}_{l} (i)

f是Graph上的N维向量， f ( i ) f(i) 与Graph的顶点一一对应， u l ( i ) u_l(i) 表示第 l l 个特征向量的第 i i 个分量。那么特征值（频率） λ l \lambda_l 下的，f的Graph 傅里叶变换就是与$lambda_l$对应的特征向量 u l u_l 进行内积运算。

f = λ 1 u 1 + ⋯ + λ l u l + ⋯ + λ N u N f=\lambda_1u_1+\dots+\lambda_lu_l+\dots+\lambda_Nu_N

< f , u l > = λ l < \mathbf{f} ,\mathbf{u}_{l}> =\lambda_l

x ^ = U T x \hat{x} =U^{T} x

x = U x ^ x=U\hat{x}

y ∗ x = U ( ( U T y ) ⊙ ( U T x ) ) y * x=U\left(\left(U^{T} y\right) \odot\left(U^{T} x\right)\right)

( x 1 ⋮ x n ) ⊙ ( y 1 ⋮ y n ) = ( x 1 ⋯ 0 ⋮ ⋱ ⋮ 0 ⋯ x n ) ( y 1 ⋮ y n ) \left( \begin{array}{c}{x_{1}} \\ {\vdots} \\ {x_{n}}\end{array}\right) \odot \left( \begin{array}{c}{y_{1}} \\ {\vdots} \\ {y_{n}}\end{array}\right)=\left( \begin{array}{ccc}{x_{1}} & {\cdots} & {0} \\ {\vdots} & {\ddots} & {\vdots} \\ {0} & {\cdots} & {x_{n}}\end{array}\right) \left( \begin{array}{c}{y_{1}} \\ {\vdots} \\ {y_{n}}\end{array}\right)

g θ ⋆ x = U g θ U ⊤ x g_{\theta } \star x=Ug_{\theta } U^{\top } x

g θ ′ ( Λ ) ≈ ∑ k = 0 K θ k ′ T k ( Λ ~ ) g_{\theta ^{\prime }} (\Lambda )\approx \sum ^{K}_{k=0} \theta ^{\prime }_{k} T_{k} (\tilde{\Lambda } )

g θ ′ ⋆ x ≈ θ 0 ′ x + θ 1 ′ ( L − I N ) x = θ 0 ′ x − θ 1 ′ D − 1 2 A D − 1 2 x g_{\theta ^{\prime }} \star x\approx \theta ^{\prime }_{0} x+\theta ^{\prime }_{1}( L-I_{N}) x=\theta ^{\prime }_{0} x-\theta ^{\prime }_{1} D^{-\frac{1}{2}} AD^{-\frac{1}{2}} x

g θ ⋆ x ≈ θ ( I N + D − 1 2 A D − 1 2 ) x g_{\theta } \star x\approx \theta \left( I_{N} +D^{-\frac{1}{2}} AD^{-\frac{1}{2}}\right) x

Z = D ~ − 1 2 A ~ D ~ − 1 2 X Θ Z=\tilde{D}^{-\frac{1}{2}}\tilde{A}\tilde{D}^{-\frac{1}{2}} X\Theta

H ( l + 1 ) = σ ( D ~ − 1 2 A ~ D ~ − 1 2 H ( l ) W ( l ) ) H^{(l+1)} =\sigma \left(\tilde{D}^{-\frac{1}{2}}\tilde{A}\tilde{D}^{-\frac{1}{2}} H^{(l)} W^{(l)}\right)

# 参考资料

https://towardsdatascience.com/spectral-clustering-82d3cff3d3b7
https://www.cnblogs.com/pinard/p/6221564.html
https://tkipf.github.io/graph-convolutional-networks/
https://ccjou.wordpress.com/2012/04/03/%E5%82%85%E7%AB%8B%E8%91%89%E7%B4%9A%E6%95%B8-%E4%B8%8B/

09-27 8728
06-14 727
12-05 2万+
07-18 2万+
09-27 1578
04-11 2188
08-09 1万+
03-03 908
07-28 651

### “相关推荐”对你有帮助么？

• 非常没帮助
• 没帮助
• 一般
• 有帮助
• 非常有帮助

Jie Qiao

¥2 ¥4 ¥6 ¥10 ¥20

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