下面所有博客是个人对EEG脑电的探索,项目代码是早期版本不完整,需要完整项目代码和资料请私聊。
数据集
1、脑电项目探索和实现(EEG) (上):研究数据集选取和介绍SEED
相关论文阅读分析:
1、EEG-SEED数据集作者的—基线论文阅读和分析
2、图神经网络EEG论文阅读和分析:《EEG-Based Emotion Recognition Using Regularized Graph Neural Networks》
3、EEG-GNN论文阅读和分析:《EEG Emotion Recognition Using Dynamical Graph Convolutional Neural Networks》
4、论文阅读和分析:Masked Label Prediction: Unified Message Passing Model for Semi-Supervised Classification
5、论文阅读和分析:《DeepGCNs: Can GCNs Go as Deep as CNNs?》
6、论文阅读和分析: “How Attentive are Graph Attention Networks?”
7、论文阅读和分析:Simplifying Graph Convolutional Networks8、论文阅读和分析:LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation
9、图神经网络汇总和总结
相关实验和代码实现:
1、用于图神经网络的脑电数据处理实现_图神经网络 脑电
2、使用GCN训练和测试EEG的公开SEED数据集
3、使用GAT训练和测试EEG公开的SEED数据集
4、使用SGC训练和测试SEED数据集
5、使用Transformer训练和测试EEG的公开SEED数据集_eeg transformer
6、使用RGNN训练和测试EEG公开的SEED数据集
辅助学习资料:
1、官网三个简单Graph示例说明三种层次的应用_graph 简单示例
2、PPI数据集示例项目学习图神经网络
3、geometric库的数据处理详解
4、NetworkX的dicts of dicts以及解决Seven Bridges of Königsberg问题
5、geometric源码阅读和分析:MessagePassin类详解和使用
6、cora数据集示例项目学习图神经网络
7、Graph 聚合
8、QM9数据集示例项目学习图神经网络
9、处理图的开源库
基本
GAT的缺点:
GAT计算的注意力非常有限:注意力得分的排名不受查询节点的限制。将这种受限的注意力正式定义为静态注意力。因为GAT使用静态注意力机制,所以存在GAT无法表达的简单图形问题:在受控问题中,发现静态注意力阻碍GAT甚至无法拟合训练数据。
提出GATv2:
一个动态图注意力变体,它比GAT更具表达力。进行了广泛的评估,表明GATv2在12个OGB和其他基准测试中优于GAT,同时匹配其参数成本。代码位于https://github.com/tech-srl/how_attentive_are_gats。GATv2 is available as part of the PyTorch Geometric library,
the DeepGraph Library,and the TensorFlow GNN library.
1、from torch_geometric.nn.conv.gatv2_conv import GATv2Conv
2、from dgl.nn.pytorch import GATv2Conv
3、from tensorflow_gnn.graph.keras.layers.gat_v2 import GATv2Convolution
结果:
算法理论:
和GAT相比,
a
T
a^T
aT的位置改变;
x
i
′
=
α
i
,
i
Θ
x
i
+
∑
j
∈
N
(
i
)
α
i
,
j
Θ
x
j
,
\mathbf{x}^{\prime}_i = \alpha_{i,i}\mathbf{\Theta}\mathbf{x}_{i} + \sum_{j \in \mathcal{N}(i)} \alpha_{i,j}\mathbf{\Theta}\mathbf{x}_{j},
xi′=αi,iΘxi+j∈N(i)∑αi,jΘxj,
注意力权重:
α
i
,
j
=
exp
(
a
⊤
L
e
a
k
y
R
e
L
U
(
Θ
[
x
i
∥
x
j
]
)
)
∑
k
∈
N
(
i
)
∪
{
i
}
exp
(
a
⊤
L
e
a
k
y
R
e
L
U
(
Θ
[
x
i
∥
x
k
]
)
)
.
\alpha_{i,j} = \frac{ \exp\left(\mathbf{a}^{\top}\mathrm{LeakyReLU}\left(\mathbf{\Theta} [\mathbf{x}_i \, \Vert \, \mathbf{x}_j] \right)\right)} {\sum_{k \in \mathcal{N}(i) \cup \{ i \}} \exp\left(\mathbf{a}^{\top}\mathrm{LeakyReLU}\left(\mathbf{\Theta} [\mathbf{x}_i \, \Vert \, \mathbf{x}_k] \right)\right)}.
αi,j=∑k∈N(i)∪{i}exp(a⊤LeakyReLU(Θ[xi∥xk]))exp(a⊤LeakyReLU(Θ[xi∥xj])).
If the graph has multi-dimensional edge features
e
i
,
j
\mathbf{e}_{i,j}
ei,j the attention coefficients
α
i
,
j
\alpha_{i,j}
αi,j are computed as:
α
i
,
j
=
exp
(
a
⊤
L
e
a
k
y
R
e
L
U
(
Θ
[
x
i
∥
x
j
∥
e
i
,
j
]
)
)
∑
k
∈
N
(
i
)
∪
{
i
}
exp
(
a
⊤
L
e
a
k
y
R
e
L
U
(
Θ
[
x
i
∥
x
k
∥
e
i
,
k
]
)
)
.
\alpha_{i,j} = \frac{ \exp\left(\mathbf{a}^{\top}\mathrm{LeakyReLU}\left(\mathbf{\Theta} [\mathbf{x}_i \, \Vert \, \mathbf{x}_j \, \Vert \, \mathbf{e}_{i,j}] \right)\right)} {\sum_{k \in \mathcal{N}(i) \cup \{ i \}} \exp\left(\mathbf{a}^{\top}\mathrm{LeakyReLU}\left(\mathbf{\Theta} [\mathbf{x}_i \, \Vert \, \mathbf{x}_k \, \Vert \, \mathbf{e}_{i,k}] \right)\right)}.
αi,j=∑k∈N(i)∪{i}exp(a⊤LeakyReLU(Θ[xi∥xk∥ei,k]))exp(a⊤LeakyReLU(Θ[xi∥xj∥ei,j])).
geometric开源的代码:
由于标准GAT中的线性层在每个层之后立即应用,因此参与节点的排名不受查询节点的限制。相反,在GATv2中,每个节点都可以处理任何其他节点。
torch_geometric.nn — pytorch_geometric documentation (pytorch-geometric.readthedocs.io)
def __init__(
self,
in_channels: Union[int, Tuple[int, int]],
out_channels: int,
heads: int = 1,
concat: bool = True,
negative_slope: float = 0.2,
dropout: float = 0.0,
add_self_loops: bool = True,
edge_dim: Optional[int] = None,
fill_value: Union[float, Tensor, str] = 'mean',
bias: bool = True,
share_weights: bool = False,
**kwargs,
):
def forward(self, x: Union[Tensor, PairTensor], edge_index: Adj,
edge_attr: OptTensor = None,
return_attention_weights: bool = None):
参考:
论文阅读和分析:Graph Attention Networks_KPer_Yang的博客-CSDN博客
https://github.com/tech-srl/how_attentive_are_gats
https://arxiv.org/abs/2105.14491
https://pytorch-geometric.readthedocs.io/en/latest/modules/nn.html#torch_geometric.nn.conv.GATv2Conv