Coder Social home page Coder Social logo

binzhou-com / factor-graph-neural-network Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zzhang1987/factor-graph-neural-network

0.0 1.0 0.0 38.33 MB

Factor Graph Neural Network

License: MIT License

Python 44.91% Shell 0.25% Jupyter Notebook 6.70% CMake 0.55% C++ 38.74% C 8.85%

factor-graph-neural-network's Introduction

Factor Graph Neural Network

Created by Zhen Zhang, Fan Wu and Wee Sun Lee.

Requirements

The following packages are required:

  1. Python 3
  2. PyTorch 1.0
  3. AD3

Introduction

Most of the successful deep neural network architectures are structured, often consisting of elements like convolutional neural networks and gated recurrent neural networks. Recently, graph neural networks have been successfully applied to graph structured data such as point cloud and molecular data. These networks often only consider pairwise dependencies, as they operate on a graph structure. We generalize the graph neural network into a factor graph neural network (FGNN) in order to capture higher order dependencies. The FGNN is defined using two types of modules, the Variable-to-Factor (VF) module and the Factor-to-Variable (FV) module. These modules are combined into a layer, and the layers can be stacked together into an algorithm. We show that the FGNN is able to exactly parameterize the Max-Product Belief Propagation algorithm, which is widely used in finding approximate \map (MAP) assignment of a PGM. Thus, for situations where belief propagation gives best solutions, the FGNN can mimic the belief propagation procedure. This repo provides the code for testing FGNN on synthetic MAP inference problem and point cloud segmentation on real dataset.

FGNN

Citation

If you find the code useful, please consider citing

@misc{1906.00554,
Author = {Zhen Zhang and Fan Wu and Wee Sun Lee},
Title = {Factor Graph Neural Network},
Year = {2019},
Eprint = {arXiv:1906.00554},
}

Build the package

Part of the ldpc decoding and encoding are in C++ and thus compiling is required. We recommend using the system compiler and using conda to install dependencies for compiling. To install dependencies, please run:

conda install cmake pybind11

Then please run the following commands for compiling:

cd lib/data/MNC
cmake .
make

MAP Inference

Dataset downloading

Download the generated synthetic dataset from synthetic_data.tar.bz2. Place the file in the root folder of the repo and run

tar -jxvf synthetic_data.tar.bz2 

Dataset generation

You can generate the dataset using the following commands

./generate_rpgm_dataset.sh

Training and testing the model

# model with fixed pairwise and higher order potential 
python train_syn_fixed_pw_hop.py

# model with fixed higher order potential but flexible pairwise potential 
python train_syn_pw_factor.py

#model with flexible pairwise and higher order potential 
python train_syn_hop_factor.py

LDPC Decoding

Dataset generation

You can generate the dataset using the following commands

./generate_ldpc_dataset.sh

Training and testing the model

python train_ldpc.py --train

factor-graph-neural-network's People

Contributors

zzhang1987 avatar

Watchers

 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.