Coder Social home page Coder Social logo

copt's Introduction

COPT: Coordinated Optimal Transport for Graph Sketching

COPT is a novel distance metric between graphs defined via an optimization routine, computing a coordinated pair of optimal transport maps simultaneously. This is an unsupervised way to learn general-purpose graph representations, it can be used for both graph sketching and graph comparison.

For a sample run script, please see demo.py. For instance, to sketch a sample graph with 400 training steps and with fixed seed we can run:

python demo.py --seed --n_epochs 400

There are many other options to allow easy custom tuning. To see all command line options, see utils.py[utils.py] or run:

python demo.py --h

For instance, one can run COPT with:

python searchGraph.py --hike --hike_interval 15 python searchGraph.py --hike --hike_interval 15 --grid_search --seed --compress_fac 4

graph.py contains core COPT routines for applications such as graph sketching and comparison. runGraph.py, searchGraph.py, etc contain various applications for COPT.

There is a data directory used by the scripts to write data to. There is some generated sample data provided. Furthermore, if one wishes to generate graph data for other named datasets, one can run the generateData.py script with the dataset name such as:;

python generateData.py --dataset_type real --dataset_name BZR

A corresponding lap.pt data file will be created.

Dependencies

PyTorch 1.1+ numpy networkx netlsd grakel

To install PyTorch, please follow these simple OS-specific instructions.

The other packages can be installed via pip, e.g. python -m pip install numpy networkx grakel netlsd. Or by running

pip install -r requirements.txt

Depending on the functionalities one wishes to run, additional dependencies include: Gromov Wasserstein by Vayer et al, can be placed as "gromov" in directory above this one.

copt's People

Contributors

twistedcubic avatar

Stargazers

 avatar Hu XinYu avatar Yang Beining avatar  avatar  avatar  avatar Eduardo Fernandes Montesuma avatar Jonathan Bac avatar  avatar Charles Dufour avatar Changtong avatar Manoj Bhat avatar Jiacheng Zhu avatar Wang Bomin avatar  avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

copt's Issues

how to reproduce community discovery experiment

Hi, i have question in reporducing the key alignment experiment both in COPT and GOT. i did this way:

  1. use nx.stochastic_block_model to construct a 40-node 4-community graph, where the probs of adding edges within/between communities are 0.9, 0.1 respectively.
  2. then i delete 10% edges (about 20) and permute the new graph.
  3. use graph.graph_dist(args, plot=False, Ly=Ly, take_ly_exp=False) to calculate COPT distance, and the args here is same as that in utils.parse_args().
  4. also use got_stochastic.find_permutaion as in runGraph.perm_mi

However, the nmi is only about 0.5, not nearly 1 like table 2 shows. Now i'm not sure the exact reason, but two guesses:

  1. does the probs parameter of nx.stochastic_block_model matters? i noticed that this parameter in utils.create_graph(40, gtype='block', params=params, seed=seed) is [0.97, 0.01, 0.01, 0.01], my case use [0.9, 0.1, 0.1, 0.1].
  2. or should we tune some hyper-parameter, while both of COPT and GOT are a little fuzzy in this experiment?like in copt, the args focus on self.optim: lr and hiking.

hope for you reply, thx !

image
image

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.