Giter VIP home page Giter VIP logo

link-prediction-on-social-networks's Introduction

社交网络上的链路预测实验

本项目代码包含以下几个链路预测算法:

  • Variational Graph Auto-Encoders:一种用于图上无监督学习的端到端可训练卷积神经网络模型,也是本论文所研究的主要方向。
  • Node2Vec:一种基于skip-gram模型的方法,用于学习给定图内随机游走的节点嵌入。
  • Spectral Clustering:使用谱嵌入从邻接矩阵创建节点表示。
  • 基线方法:Adamic-Adar, Jaccard Coefficient,,Preferential Attachment

环境依赖包

  • Python 3.6.6
  • tensorflow 1.12.0
  • networkx 2.2
  • scipy 1.2.1
  • scikit-learn 0.20.2
  • pandas 0.24.0
  • gensim 3.7.1
  • matplotlib 3.0.3 系统安装配置好Python环境后,可使用python setup.py install 安装依赖。

代码文件说明

数据文件

  • data/: 存放有advogato、facebook、fb-processed、gplus、hamster、twitter六个数据文件夹,里边包含原始网络边数据的txt文件和转化的邻接矩阵的pickle数据文件。
  • train-test-split/: data文件夹中的数据集经过不同隐藏边比例划分后,存放在train-test-split文件夹。
  • network-statistics/: 存放data文件夹数据集和networkx随机网络中结构信息,例如节点数、边数等。
  • visualizations/: Visualizations of each network generated by networkx and matplotlib
  • network-statistics/: 存放data文件夹中部分数据的网络拓扑图和networkx随机网络图。
  • result/: 保存链路预测结果。包含不同算法在五种社交网络和随机网络的结果。

代码文件

  • gae/: 单独的VGAE模型代码以及数据文件。
  • node2vec.py: node2vec算法代码。
  • setup.py: 依赖包封装。

生成邻接矩阵

使用data文件夹的数据进行以下操作:

  • process-fb-network.py:对10个Facebook自我中心网络进行预处理,生成邻接矩阵保存到data/fb-processed文件夹。
  • process-fb-combined-network.py: 对把10个Facebook自我中心网络组合,生成邻接矩阵保存到data/fb-processed文件夹。
  • process-others-network.py: 把advogato、gplus、hamster、twitter四个社交网络,生成邻接矩阵保存到data文件夹下对应文件夹中。

数据集划分

使用上一步生成邻接矩阵的pickle文件进行以下操作:

  • train-test-splits-fb.py:对Facebook自我中心网络和他们组合的网络以及BA、PC、SBM三个随机网络按照不同隐藏边比例进行划分,结果保存在train-test-splits文件夹。
  • train-test-splits-others.py: 对advogato、gplus、hamster、twitter四个社交网络按照不同隐藏边比例进行划分,结果保存在train-test-splits文件夹。

评测指标

  • link_prediction_scores.py: 包含AA、JC、PA、SC、Node2Vec、VGAE等方法的评估得分函数,计算链路预测AUC值和AP值。

运行实验

  • run-all-experiments.py: 在Facebook网络和三个随机网络上运行所有链接预测方法,返回结果,保存到results文件夹。
  • run-others-experiments.py: 在advogato、gplus、hamster、twitter四个社交网络上运行所有链接预测方法,返回结果,保存到results文件夹。
  • network-visualizations-statistics.py: 统计所有的网络结构信息,结果保存到network- statistics文件夹。绘制部分网络图,保存到visualization文件夹。
  • plot-curves.py: 绘制部分ROC曲线和PR曲线。

link-prediction-on-social-networks's People

Contributors

yebiro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.