GEM是一个NE的集成工具箱:https://github.com/palash1992/GEM/
第一次安装时提示报错:
File "gem/version.py", line 3
short_version = '1.0.0'
^
要把这个文件中的所有语句前面的tab去掉后再执行sudo python setup.py install 即可安装成功
因为keras为2.1.2 但GEM中要求2.0.2, 所以还没法用GEM实现node2vec 和SDNE
可实现:
- Laplacian Eigenmaps
- Locally Linear Embedding
- Graph Factorization
-
Higher-Order Proximity preserved Embedding (HOPE)
(画图功能会报错,已注释掉run_karate.py line71)
运行结果:
Iter id: 0, Objective: 77.0056, f1: 76.9963, f2: 0.00933457
Iter id: 10000, Objective: 76.9883, f1: 76.9809, f2: 0.00739893
Iter id: 20000, Objective: 76.9814, f1: 76.9717, f2: 0.00962441
Iter id: 30000, Objective: 76.9783, f1: 76.9675, f2: 0.0107479
Iter id: 40000, Objective: 76.977, f1: 76.9658, f2: 0.0112291
graph_factor_sgd: (慢!)
Training time: 71.880028
MAP: 0.764125973429 preccision curve: [0.0, 0.5, 0.6666666666666666, 0.75, 0.8]
Num nodes: 34, num edges: 77
SVD error (low rank): 0.053622
hope_gsvd:(又快又好)
Training time: 0.201917
MAP: 0.834648134445 preccision curve: [1.0, 1.0, 1.0, 1.0, 1.0]
Num nodes: 34, num edges: 77
Laplacian matrix recon. error (low rank): 6.293280
lap_eigmap_svd: (精确度下降?)
Training time: 0.086494
MAP: 0.511774195685 preccision curve: [1.0, 1.0, 0.6666666666666666, 0.5, 0.4]
Num nodes: 34, num edges: 77
lle_svd:(精确度下降?)
Training time: 0.036748
MAP: 0.625323321278 preccision curve: [1.0, 1.0, 0.6666666666666666, 0.5, 0.4]