Code Monkey home page Code Monkey logo

hin2vec's Introduction

HIN2Vec

HIN2Vec learns distributed representations of nodes in heterogeneous information networks (HINs) by capturing the distiguishing metapath relationships between nodes. Please refer the paper here.

Prepare

Compile the source code

cd model_c/src
make

How to use?

Example

To run HIN2Vec on Zachary's karate club network, execute the following command from the repository home directory:

python main.py res/karate_club_edges.txt node_vectors.txt metapath_vectors.txt -l 1000 -d 2 -w 2

Options

See help for the other available options to use with HIN2Vec.

python main.py --help

Input HIN format

The supported input format is an edgelist (separated by TAB):

node1_name node2_type node2_name node2_type edge_type

The input graph is assumed to be directed by default, which means that for an edge in a undirected graph, you need to add two directed edges. For example:

1 U 11 U U-U ... 11 U 1 U U-U ...

Output

After learning, HIN2Vec outputs two files: node representations and metapath representations.

The node representation file has n+1 lines for a graph with n nodes with the following format.

num_of_nodes dim_of_representation
node_id dim1 dim2 ... dimd
...

where dim1, ... , dimd is the d-dimensional node representation learned by HIN2Vec.

The metapath representation file has k+1 lines for a graph with k targeted metapath relationships with the following format.

num_of_metapaths dim_of_representation
metapath1 dim1 dim2 ... dimd

where dim1, ... , dimd is the d-dimensional metapath representation learned by HIN2Vec. The number of target metapaths is related to the window size set for learning and the schema of the given graph.

Check the learned vectors

Members in the Zachary's karate club network natually seperate into two groups. To treat the group classification for members as a binary classification:

python tools/exp_classification.py node_vectors.txt res/karate_club_groups.txt

Citing

If you find HIN2Vec useful for your research, please cite the following paper:

@inproceedings{fu2017hin2vec,
    title={HIN2Vec: Explore Meta-paths in Heterogeneous Information Networks for Representation Learning},
    author={Fu, Tao-yang and Lee, Wang-Chien and Lei, Zhen},
    booktitle={Proceedings of the 2017 ACM on Conference on Information and Knowledge Management},
    pages={1797--1806},
    year={2017},
    organization={ACM}
}

Miscellaneous

Please send any questions you might have about the code and/or the algorithm to [email protected] or [email protected].

hin2vec's People

Contributors

tabris223 avatar csiesheep 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.