Code Monkey home page Code Monkey logo

communitygan's Introduction

CommunityGAN

  • This repository is the implementation of CommunityGAN:

CommunityGAN: Community Detection with Generative Adversarial Nets

Files in the folder

  • data/: graph and community data
  • pre_train/: pre-trained vertex embeddings

    Note: the dimension of pre-trained vertex embeddings should equal n_emb in src/CommunityGAN/config.py

  • results/: evaluation results and the learned embeddings of the generator and the discriminator
  • src/: source codes for CommunityGAN and pre-train model

Data format

The input file for CommunityGAN (data/community_detection/*_train.txt): An undirected graph in which vertex IDs start from 0 to N-1 (N is the number of nodes in the graph). Each line contains two node IDs indicating an edge in the graph.

The input file for the pre-train model (data/community_detection/*_agm.txt): Similar to the input file for CommunityGAN. The only difference is that in this file one edge need occur twice: node1 node2 and node2 node1

The community file (data/community_detection/*.sampled.cmty.txt): Each line means a community and the numbers indicate the vertices in the community.

CommunityGAN

Requirements

The code of CommunityGAN has been tested running under Python 3.6.1, with the following packages installed (along with their dependencies):

  • tensorflow == 1.6.0
  • numpy == 1.12.1
  • scipy == 1.1.0

Basic usage

The basic usage of CommunityGAN is as follow:

cd src/CommunityGAN
python community_gan.py

The parameters for CommunityGAN can be changed by editing src/CommunityGAN/config.py or passing through the command line. An example of running CommunityGAN on the three datasets are written in scripts/run.py, which can be called by:

cd scripts
python run.py

Pre-train model

Compile

Get into the src/PreTrain directory and use make command to compile. Has been tested on Ubuntu with g++ 5.3.0, and on Windows with MinGW-w64 5.3.0.

Basic usage

A basic usage example of the pre-train model has been written in scripts/prepare_pretrain_embedding.py. The following commands can be used to re-prepare the pre-train embeddings for CommunityGAN on the three datasets:

cd scripts
python prepare_pretrain_embedding.py

communitygan's People

Contributors

samjia avatar

Watchers

James Cloos 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.