下载源代码
https://github.com/phanein/deepwalk
数据集的定义
http://leitang.net/social_dimension.html
核心代码
walks = graph.build_deepwalk_corpus(G, num_paths=args.number_walks, path_length=args.walk_length, alpha=0, rand=random.Random(args.seed))
print(\"Training...\")
model = Word2Vec(walks, size=args.representation_size, window=args.window_size, min_count=0, workers=args.workers)
安装
cd deepwalk-master
pip install -r requirements.txt
python setup.py install
复现试验结果
1. BlogCatalog dataset
生成 ding
deepwalk --format mat --input example_graphs/blogcatalog.mat --max-memory-data-size 0 --number-walks 80 --representation-size 128 --walk-length 40 --window-size 10 --workers 1 --output example_graphs/blogcatalog. dings
评估
python example_graphs/scoring.py --emb example_graphs/blogcatalog. dings --network example_graphs/blogcatalog.mat --num-shuffle 10 --all
2. Karate dataset
生成 ding
--format默认.adjlist文件
deepwalk --input example_graphs/karate.adjlist --max-memory-data-size 0 --number-walks 80 --representation-size 128 --walk-length 40 --window-size 10 --workers 1 --output example_graphs/karate. dings
评估
--network需要.mat文件
option如下:
usage: scoring [-h] --emb EMB --network NETWORK
[--adj-matrix-name ADJ_MATRIX_NAME]
[--label-matrix-name LABEL_MATRIX_NAME]
[--num-shuffles NUM_SHUFFLES] [--all]
optional arguments:
-h, --help show this help message and exit
--emb EMB dings file (default: None)
--network NETWORK A .mat file containing the adjacency matrix and node
labels of the input network. (default: None)
--adj-matrix-name ADJ_MATRIX_NAME
Variable name of the adjacency matrix inside the .mat
file. (default: network)
--label-matrix-name LABEL_MATRIX_NAME
Variable name of the labels matrix inside the .mat
file. (default: group)
--num-shuffles NUM_SHUFFLES
Number of shuffles. (default: 2)
--all The dings are evaluated on all training percents
from 10 to 90 when this flag is set to true. By
default, only training percents of 10, 50 and 90 are
used. (default: False)
---------------------
作者:YizhuJiao
来源:CSDN
原文:https://blog.csdn.net/YizhuJiao/article/details/81095346
版权声明:本文为博主原创文章,转载请附上博文链接!
继续阅读与本文标签相同的文章
工信部:持续提升绿色计算的商业价值和市场竞争力
-
日本“老婆机器人”被抢购一空!用户满意度极高:听话且百依百顺
2026-05-18栏目: 教程
-
2019亚洲国际物流技术与运输系统展览会期待您的到来
2026-05-18栏目: 教程
-
数码人荣获2019年数据中心科技成果奖
2026-05-18栏目: 教程
-
北京市消协:教你一眼看穿互联网消费捆绑搭售的隐蔽花样
2026-05-18栏目: 教程
-
什么是人工智能?人工智能工程技术人员都做什么?
2026-05-18栏目: 教程
