Deepwalk在线学习社会表现。

deepwalk的Python项目详细描述


deepwalk使用短随机游动来学习图中顶点的表示。

用法

示例用法
$deepwalk --input example_graphs/karate.adjlist --output karate.embeddings

–输入输入文件名

  1. ^{tt2}$ for an adjacency list, e.g:

    1 2 3 4 5 6 7 8 9 11 12 13 14 18 20 22 32
    2 1 3 4 8 14 18 20 22 31
    3 1 2 4 8 9 10 14 28 29 33
    ...
    
  2. ^{tt3}$ for an edge list, e.g:

    1 2
    1 3
    1 4
    ...
    
  3. ^{tt4}$ for a Matlab .mat file containing an adjacency matrix

    (note, you must also specify the variable name of the adjacency matrix ^{tt5}$)

–输出output_filename

The output representations in skipgram format - first line is header, all other lines are node-id and d dimensional representation:

34 64
1 0.016579 -0.033659 0.342167 -0.046998 ...
2 -0.007003 0.265891 -0.351422 0.043923 ...
...
full命令列表
命令行选项的完整列表可用于$deepwalk --help

评估

在这里,我们将展示如何在deepwalk paper中使用的blogcatalog数据集上评估deepwalk。 首先,我们运行以下命令以生成其deepwalk嵌入:

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.embeddings

此处指定的参数与论文中的参数相同。 如果您使用的是多核机器,请尝试将--workers设置为更大的数字,以便更快地进行训练。 在具有24个xeon e5-2620@2.00ghz CPU的单机上,此命令大约需要20分钟才能完成(--workers设置为20)。 然后,我们使用example_graphs/scoring.py

评估多标签节点分类任务中学习到的嵌入。
python example_graphs/scoring.py --emb example_graphs/blogcatalog.embeddings
--network example_graphs/blogcatalog.mat
--num-shuffle 10 --all

此命令在同一台计算机上8分钟后完成。为了更快地计算,您可以将--num-shuffle设置为较小的数字,但期望性能有更大的波动。不同标记节点比例得到的微观f1和宏观f1得分如下:

% Labeled Nodes10%20%30%40%50%60%70%80%90%
Micro-F1 (%)35.8638.5139.9640.7641.5141.8542.2742.3542.40
Macro-F1 (%)21.0823.9825.7126.7327.6828.2828.8828.7028.21

请注意,当前版本的deepwalk基于较新版本的gensim,它可能具有word2vec模型的不同实现。要完全复制本文中的结果,您可能需要安装较旧版本的gensim(版本0.10.2)。

要求

  • 努比
  • scipy

(可能必须独立安装)

安装

  1. CD deepwalk
  2. pip install-r requirements.txt
  3. python setup.py安装

引用

如果您发现deepwalk对您的研究有用,我们请您引用以下论文:

@inproceedings{Perozzi:2014:DOL:2623330.2623732,
 author = {Perozzi, Bryan and Al-Rfou, Rami and Skiena, Steven},
 title = {DeepWalk: Online Learning of Social Representations},
 booktitle = {Proceedings of the 20th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining},
 series = {KDD '14},
 year = {2014},
 isbn = {978-1-4503-2956-9},
 location = {New York, New York, USA},
 pages = {701--710},
 numpages = {10},
 url = {http://doi.acm.org/10.1145/2623330.2623732},
 doi = {10.1145/2623330.2623732},
 acmid = {2623732},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {deep learning, latent representations, learning with partial labels, network classification, online learning, social networks},
}

其他

Deepwalk-在线学习社会表现。

https://badge.fury.io/py/deepwalk.pnghttps://travis-ci.org/phanein/deepwalk.png?branch=masterhttps://pypip.in/d/deepwalk/badge.png

历史记录

1.0.3(2018-03-23)

  • 现在与最新版本的Gensim和Sklearn兼容
  • 更好地支持Python3

1.0.2(2014-09-19)

  • 固定gensim为0.10.2

1.0.1(2014-09-19)

  • 添加实用程序以支持为较大图形生成的嵌入
  • 支持其他输入文件格式

1.0.0(2014-08-24)

  • pypi上的第一个版本。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
amazon web services Java AWS s3:如何使用Md5预签名url设置和上载内容   twitter使用java从推文中排除一些单词   如何在GUI java中添加延迟时间   java程序,如何使用Outputstream发送两次消息   java为什么是javax。在将Yasson与JSONB一起使用时,Glassfish中的json需要作为依赖项吗?   如何从dist文件夹中读取文件   java如何获取与模式匹配的文件列表   java如何使用Intent从Android应用程序发送彩信?   java限制对Spring的依赖,同时又不丧失框架的功能   java是否将捕获异常报告给Firebase/Fabric等?   用jdbcjava实现mysql分页   给定URI的java注释检索   java是序列化/反序列化公共枚举的简单方法?   java如何使用jMockit模拟本机方法