GCN BASED ON pytorch geometric

Posted Sarah_Ann

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了GCN BASED ON pytorch geometric相关的知识,希望对你有一定的参考价值。

导入需要用到的库和模块

`import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
from torch_geometric.nn import GCNConv
from torch_geometric.datasets import Planetoid
from torch_geometric.utils import to_networkx
import networkx as nx
from sklearn.metrics import accuracy_score
from sklearn.manifold import TSNE #对数据特征进行降维
from sklearn.svm import SVC
from sklearn.semi_supervised import label_propagation

数据下载

dataset=Planetoid(root=\'G:/GCN_pytorch/Cora\',name=\'Cora\')
print(\'classes num :\',dataset.num_classes)
print(\'edge feature num:\',dataset.num_edge_features)
print(\'edge nums:\',dataset.data.edge_index.shape[1]/2)
print(\'node feature nums:\',dataset.num_node_features)
print(\'node nums:\',dataset.data.x.shape[0])

data属性

print(dataset.data)

`

以上是关于GCN BASED ON pytorch geometric的主要内容,如果未能解决你的问题,请参考以下文章

图神经网络—GCN-pytorch版本代码详解

Pytorch+PyG实现GCN(图卷积网络)

图卷积神经网络(GCN)综述与实现(PyTorch版)

Pytorch实现GCN(基于Message Passing消息传递机制实现)

Class-Balanced Loss Based on Effective Number of Samples - 2 - 代码学习

[记录]calculate age based on date of birth