下载源代码
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