GithubHelp home page GithubHelp logo

hell-to-heaven / harp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gtmac/harp

0.0 1.0 0.0 2.92 MB

Code for the AAAI 2018 Paper "HARP: Hierarchical Representation Learning for Networks"

License: MIT License

Python 100.00%

harp's Introduction

HARP

Code for the AAAI 2018 paper "HARP: Hierarchical Representation Learning for Networks". HARP is a meta-strategy to improve several state-of-the-art network embedding algorithms, such as DeepWalk, LINE and Node2vec.

You can read the preprint of our paper on Arxiv.

This code run with Python 2.

Installation

The following Python packages are required to install HARP.

magicgraph is a library for processing graph data. To install, run the following commands:

git clone https://github.com/phanein/magic-graph.git
cd magic-graph
python setup.py install

Then, install HARP and the other requirements:

git clone https://github.com/GTmac/HARP.git
cd HARP
pip install -r requirements.txt

Usage

To run HARP on the CiteSeer dataset using LINE as the underlying network embedding model, run the following command:

python src/harp.py --input example_graphs/citeseer/citeseer.mat --model line --output citeseer.npy --sfdp-path bin/sfdp_linux

Parameters available:

--input: input_filename

  1. --format mat for a Matlab .mat file containing an adjacency matrix. By default, the variable name of the adjacency matrix is network; you can also specify it with --matfile-variable-name.

  2. --format adjlist 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

    ...

  3. --format edgelist for an edge list, e.g:

    1 2

    1 3

    1 4

    2 5

    ...

--output: output_filename The output representations in Numpy .npy format. Note that we assume the nodes in your input file are indexed from 0 to N - 1.

--model model_name The underlying network embeddings model to use. Could be deepwalk, line or node2vec. Note that node2vec uses the default parameters, which is p=1.0 and q=1.0.

--sfdp-path sfdp_path Path to the binary file of SFDP, which is the module we used for graph coarsening. You can set it to sfdp_linux, sfdp_osx or sfdp_windows.exe depending on your operating system.

More options: The full list of command line options is available with python src/harp.py --help.

Evaluation

To evaluate the embeddings on a multi-label classification task, run the following command:

python src/scoring.py -e citeseer.npy -i example_graphs/citeseer/citeseer.mat -t 1 2 3 4 5 6 7 8 9

Where -e specifies the embeddings file, -i specifies the .mat file containing node labels, and -t specifies the list of training example ratios to use.

Note

SFDP is a library for multi-level graph drawing, which is a part of GraphViz. We use SFDP for graph coarsening in this implementation. Note that SFDP is included as a binary file under /bin; please choose the proper binary file according to your operation system. Currently we have the binary files under OSX, Linux and Windows.

Citation

If you find HARP useful in your research, please cite our paper:

@inproceedings{harp,
	title={HARP: Hierarchical Representation Learning for Networks},
	author={Chen, Haochen and Perozzi, Bryan and Hu, Yifan and Skiena, Steven},
	booktitle={Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence},
	year={2018},
	organization={AAAI Press}
}

harp's People

Contributors

gtmac avatar mongooma avatar example123 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.