首页 人工智能 深度学习     /    图神经收集构建代码

图神经收集构建代码

上传者: jinmaodao1990 | 上传时间:2023/4/8 5:48:07 | 文件大小:119KB | 文件类型:zip
图神经收集构建代码
#GPF##一、GPF(GraphProcessingFlow):行使图神经收集处置下场的普通化流程一、图节点预展现:行使NE框架,直接患上到全图每一个节点的Embedding;二、正负样本采样:(1)单节点样本;
(2)节点对于样本;
三、抽取封锁子图:可做类化处置,建树一种通用图数据结构;四、子图特色领悟:预展现、节点特色、全局特色、边特色;五、收集配置配备枚举:可所以图输入、图输入的收集;
也可所以图输入,分类/聚类下场输入的收集;六、熬炼以及测试;##二、首要文件:一、graph.py:读入图数据;二、embeddings.py:预展现学习;三、sample.py:采样;四、subgraphs.py/s2vGraph.py:抽取子图;五、batchgraph.py:子图特色领悟;六、classifier.py:收集配置配备枚举;七、parameters.py/until.py:参数配置配备枚举/帮手文件;##三、使用一、在parameters.py中配置配备枚举相关参数(可默许);
二、在example/文件夹中运行响应的案例文件--搜罗链接料想、节点外形料想;
以链接料想为例:###一、导入配置配备枚举参数```fromparametersimportparser,cmd_embed,cmd_opt```###二、参数转换```args=parser.parse_args()args.cuda=notargs.noCudaandtorch.cuda.is_available()torch.manual_seed(args.seed)ifargs.cuda:torch.cuda.manual_seed(args.seed)ifargs.hop!='auto':args.hop=int(args.hop)ifargs.maxNodesPerHopisnotNone:args.maxNodesPerHop=int(args.maxNodesPerHop)```###三、读取数据```g=graph.Graph()g.read_edgelist(filename=args.dataName,weighted=args.weighted,directed=args.directed)g.read_node_status(filename=args.labelName)```###四、患上到全图节点的Embedding```embed_args=cmd_embed.parse_args()embeddings=embeddings.learn_embeddings(g,embed_args)node_information=embeddings#printnode_information```###五、正负节点采样```train,train_status,test,test_status=sample.sample_single(g,args.testRatio,max_train_num=args.maxTrainNum)```###六、抽取节点对于的封锁子图```net=until.nxG_to_mat(g)#printnettrain_graphs,test_graphs,max_n_label=subgraphs.singleSubgraphs(net,train,train_status,test,test_status,args.hop,args.maxNodesPerHop,node_information)print('#train:%d,#test:%d'%(len(train_graphs),len(test_graphs)))```###七、加载收集模子,并在classifier中配置配备枚举相关参数```cmd_args=cmd_opt.parse_args()cmd_args.feat_dim=max_n_label+1cmd_args.attr_dim=node_information.shape[1]cmd_args.latent_dim=[int(x)forxincmd_args.latent_dim.split('-')]iflen(cmd_args.latent_dim) 本软件ID:10992498

文件下载

资源详情

[{"title":"(80个子文件119KB)图神经网络构建代码","children":[{"title":"GPF-master","children":[{"title":".gitignore <span style='color:#111;'>1.17KB</span>","children":null,"spread":false},{"title":"GPF","children":[{"title":"data","children":[{"title":"Testdata.ipynb <span style='color:#111;'>3.31KB</span>","children":null,"spread":false},{"title":"USAir.edgeList.txt <span style='color:#111;'>15.84KB</span>","children":null,"spread":false},{"title":"karate.label.txt <span style='color:#111;'>159B</span>","children":null,"spread":false},{"title":"USAir.mat <span style='color:#111;'>5.09KB</span>","children":null,"spread":false},{"title":"USAir.label.txt <span style='color:#111;'>1.84KB</span>","children":null,"spread":false},{"title":"karate.edgelist.txt <span style='color:#111;'>389B</span>","children":null,"spread":false}],"spread":true},{"title":"GraphNet","children":[{"title":"pscn.py <span style='color:#111;'>2.64KB</span>","children":null,"spread":false},{"title":"__init__.py <span style='color:#111;'>0B</span>","children":null,"spread":false},{"title":"s2v_lib.py <span style='color:#111;'>6.18KB</span>","children":null,"spread":false},{"title":"s2v_lib","children":[{"title":"mlp.py <span style='color:#111;'>1.67KB</span>","children":null,"spread":false},{"title":"embedding.py <span style='color:#111;'>4.74KB</span>","children":null,"spread":false},{"title":"Makefile <span style='color:#111;'>825B</span>","children":null,"spread":false},{"title":"src","children":[{"title":"lib","children":[{"title":"config.cpp <span style='color:#111;'>51B</span>","children":null,"spread":false},{"title":"graph_struct.cpp <span style='color:#111;'>1.69KB</span>","children":null,"spread":false},{"title":"msg_pass.cpp <span style='color:#111;'>2.68KB</span>","children":null,"spread":false}],"spread":true},{"title":"s2v_lib.cpp <span style='color:#111;'>3.61KB</span>","children":null,"spread":false}],"spread":true},{"title":"build","children":[{"title":"dll","children":[{"title":"libs2v.d <span style='color:#111;'>160B</span>","children":null,"spread":false},{"title":"libs2v.so <span style='color:#111;'>32.46KB</span>","children":null,"spread":false}],"spread":false},{"title":"lib","children":[{"title":"config.o <span style='color:#111;'>2.05KB</span>","children":null,"spread":false},{"title":"graph_struct.o <span style='color:#111;'>15.05KB</span>","children":null,"spread":false},{"title":"config.d <span style='color:#111;'>56B</span>","children":null,"spread":false},{"title":"msg_pass.d <span style='color:#111;'>105B</span>","children":null,"spread":false},{"title":"graph_struct.d <span style='color:#111;'>74B</span>","children":null,"spread":false},{"title":"msg_pass.o <span style='color:#111;'>8.88KB</span>","children":null,"spread":false}],"spread":false}],"spread":true},{"title":"s2v_lib.py <span style='color:#111;'>6.16KB</span>","children":null,"spread":false},{"title":"include","children":[{"title":"msg_pass.h <span style='color:#111;'>453B</span>","children":null,"spread":false},{"title":"config.h <span style='color:#111;'>657B</span>","children":null,"spread":false},{"title":"s2v_lib.h <span style='color:#111;'>847B</span>","children":null,"spread":false},{"title":"graph_struct.h <span style='color:#111;'>2.60KB</span>","children":null,"spread":false}],"spread":false},{"title":"pytorch_util.py <span style='color:#111;'>1.81KB</span>","children":null,"spread":false}],"spread":true},{"title":"gat.py <span style='color:#111;'>2.17KB</span>","children":null,"spread":false},{"title":"gcn_layers.py <span style='color:#111;'>1.22KB</span>","children":null,"spread":false},{"title":"pytorch_util.py <span style='color:#111;'>1.81KB</span>","children":null,"spread":false},{"title":"gcn.py <span style='color:#111;'>1.83KB</span>","children":null,"spread":false},{"title":"mlp_dropout.py <span style='color:#111;'>1.94KB</span>","children":null,"spread":false},{"title":"DGCNN.py <span style='color:#111;'>5.68KB</span>","children":null,"spread":false},{"title":"gat_layers.py <span style='color:#111;'>3.61KB</span>","children":null,"spread":false}],"spread":false},{"title":"src","children":[{"title":"classifier.py <span style='color:#111;'>4.95KB</span>","children":null,"spread":false},{"title":"subgraphs.py <span style='color:#111;'>10.79KB</span>","children":null,"spread":false},{"title":"sample.py <span style='color:#111;'>2.24KB</span>","children":null,"spread":false},{"title":"batchgraph.py <span style='color:#111;'>1.86KB</span>","children":null,"spread":false},{"title":"graph.py <span style='color:#111;'>3.30KB</span>","children":null,"spread":false},{"title":"Parameters.py <span style='color:#111;'>8.08KB</span>","children":null,"spread":false},{"title":"s2vGraph.py <span style='color:#111;'>1.22KB</span>","children":null,"spread":false},{"title":"main_pairs.py <span style='color:#111;'>2.43KB</span>","children":null,"spread":false},{"title":"main_single.py <span style='color:#111;'>2.50KB</span>","children":null,"spread":false},{"title":"main_fixDegree.py <span style='color:#111;'>2.51KB</span>","children":null,"spread":false},{"title":"embeddings.py <span style='color:#111;'>3.56KB</span>","children":null,"spread":false},{"title":"until.py <span style='color:#111;'>600B</span>","children":null,"spread":false}],"spread":false},{"title":"example","children":[{"title":"main_pairs.py <span style='color:#111;'>2.48KB</span>","children":null,"spread":false},{"title":"main_single.py <span style='color:#111;'>2.55KB</span>","children":null,"spread":false},{"title":"main_fixDegree.py <span style='color:#111;'>2.56KB</span>","children":null,"spread":false}],"spread":true},{"title":"readme.txt <span style='color:#111;'>776B</span>","children":null,"spread":false},{"title":"NE","children":[{"title":"sdne.py <span style='color:#111;'>11.27KB</span>","children":null,"spread":false},{"title":"gcn","children":[{"title":"__init__.py <span style='color:#111;'>0B</span>","children":null,"spread":false},{"title":"layers.py <span style='color:#111;'>5.75KB</span>","children":null,"spread":false},{"title":"models.py <span style='color:#111;'>6.21KB</span>","children":null,"spread":false},{"title":"utils.py <span style='color:#111;'>5.31KB</span>","children":null,"spread":false},{"title":"metrics.py <span style='color:#111;'>691B</span>","children":null,"spread":false},{"title":"gcnAPI.py <span style='color:#111;'>6.73KB</span>","children":null,"spread":false},{"title":"gcn.py <span style='color:#111;'>6.73KB</span>","children":null,"spread":false},{"title":"inits.py <span style='color:#111;'>810B</span>","children":null,"spread":false},{"title":"train.py <span style='color:#111;'>3.90KB</span>","children":null,"spread":false}],"spread":true},{"title":"__init__.py <span style='color:#111;'>0B</span>","children":null,"spread":false},{"title":"hope.py <span style='color:#111;'>1.61KB</span>","children":null,"spread":false},{"title":"gf.py <span style='color:#111;'>2.48KB</span>","children":null,"spread":false},{"title":"lap.py <span style='color:#111;'>1.77KB</span>","children":null,"spread":false},{"title":"graph.py <span style='color:#111;'>3.37KB</span>","children":null,"spread":false},{"title":"grarep.py <span style='color:#111;'>2.26KB</span>","children":null,"spread":false},{"title":"__main__.py <span style='color:#111;'>8.40KB</span>","children":null,"spread":false},{"title":"walker.py <span style='color:#111;'>5.98KB</span>","children":null,"spread":false},{"title":"node2vec.py <span style='color:#111;'>1.56KB</span>","children":null,"spread":false},{"title":"line.py <span style='color:#111;'>10.81KB</span>","children":null,"spread":false},{"title":"classify.py <span style='color:#111;'>3.10KB</span>","children":null,"spread":false},{"title":"lle.py <span style='color:#111;'>1.72KB</span>","children":null,"spread":false},{"title":"tadw.py <span style='color:#111;'>4.27KB</span>","children":null,"spread":false}],"spread":false}],"spread":true},{"title":"LICENSE <span style='color:#111;'>1.04KB</span>","children":null,"spread":false},{"title":"README.md <span style='color:#111;'>6.30KB</span>","children":null,"spread":false},{"title":"gpf.JPG <span style='color:#111;'>19.66KB</span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

免责申明

【好快吧下载】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【好快吧下载】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【好快吧下载】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,8686821#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明