Home

Awesome

OpenHINE

This is an open-source toolkit for Heterogeneous Information Network Embedding(OpenHINE) with version 0.1. We can train and test the model more easily. It provides implementations of many popular models, including: DHNE, HAN, HeGAN, HERec, HIN2vec, Metapath2vec, MetaGraph2vec, RHINE. More materials can be found in www.shichuan.org.

We build a new toolkit OpenHGNN, which is a high-level package built on top of DGL. It will have Better Extensibility, Better Encapsulation and More Effiencient. And it includes two embedding models, Metapath2vec and HeRec.

convenience provided:

Contributors:

DMGroup from BUPT: Tianyu Zhao, Meiqi Zhu, Nian Liu, Jiawei Liu, Hongrui Liu, Guanyi Chu, Jiayue Liu, Jianan Zhao, Xiao Wang, Cheng Yang, Chuan Shi.

Get started

Requirements and Installation

config/Usage

Input parameter
python train.py -m model_name -d dataset_name

e.g.

python train.py -m Metapath2vec -d acm
Model Setup

The model parameter could be modified in the file ( ./src/config.ini ).

​ --alpha: learning rate

​ --dim: dimension of output

​ --epoch: the number of iterations

​ --num_workers:number of workers for dataset loading (It should be set to 0, if you are in trouble with Windows OS.)

​ etc...

​ --metapath: the metapath selected

​ --neg_num: the number of negative samples

​ etc...

Datasets

If you want to train your own dataset, create the file (./dataset/your_dataset_name/edge.txt) and the format is as follows:

input: edge

​ src_node_id dst_node_id edge_type weight

​ e.g.

	19	7	p-c	2
	19	7	p-a	1
	11	0	p-c	1
	0	11	c-p	1

PS:The input graph is directed and the undirected needs to be transformed into directed graph.

Input: feature

​ number_of_nodes embedding_dim

​ node_name dim1 dim2

e.g.

11246	2
a1814 0.06386946886777878 -0.04781734198331833
a0 ... ...

Model

Available

[DHNE AAAI 2018]

​ Structural Deep Embedding for Hyper-Networks

​ src code:https://github.com/tadpole/DHNE

[HAN WWW 2019]

​ Heterogeneous Graph Attention Network

​ Add feature.txt into the input folder or set the parameter "featype": "adj", which means that you will use adjacency matrix as your feature.

​ src code:https://github.com/Jhy1993/HAN

[HeGAN KDD 2019]

​ Adversarial Learning on Heterogeneous Information Network

​ src code:https://github.com/librahu/HeGAN

[HERec TKDE 2018]

​ Heterogeneous Information Network Embedding for Recommendation

​ src code:https://github.com/librahu/HERec

*spec para:

​ metapath_list: pap|psp (split by "|")

[HIN2Vec CIKM 2017]

​ HIN2Vec: Explore Meta-paths in Heterogeneous Information Networks for Representation Learning

​ src code:https://github.com/csiesheep/hin2vec

[metapath2vec KDD 2017]

​ metapath2vec: Scalable Representation Learning for Heterogeneous Networks

​ src code:https://ericdongyx.github.io/metapath2vec/m2v.html

​ the python version implemented by DGL:https://github.com/dmlc/dgl/tree/master/examples/pytorch/metapath2vec

[MetaGraph2Vec PAKDD 2018]

​ MetaGraph2Vec: Complex Semantic Path Augmented Heterogeneous Network Embedding

​ src code:https://github.com/daokunzhang/MetaGraph2Vec

[PTE KDD 2015]

​ PTE: Predictive Text Embedding through Large-scale Heterogeneous Text Networks

​ src code:https://github.com/mnqu/PTE

[RHINE AAAI 2019]

​ Relation Structure-Aware Heterogeneous Information Network Embedding

​ only supported in the Linux

​ src code:https://github.com/rootlu/RHINE 

Output

Test

python test.py -d dataset_name -m model_name -n file_name

The output embedding file name can be found in (./output/embedding/model_name/) .

e.g.

python test.py -d dblp -m HAN -n node.txt
output: embedding

​ number_of_nodes embedding_dim

​ node_name dim1 dim2

e.g.

11246	2
a1814 0.06386946886777878 -0.04781734198331833
a0 ... ...

Evaluation/Task

ACM datasetMicro-F1Macro-F1NMI
DHNE0.72010.70070.3280
HAN0.84010.83620.4241
HeGAN0.83080.82760.4335
HERec0.83080.83040.3618
HIN2vec0.84580.84490.4148
Metapath2vec(PAP)0.78230.77250.2828
MetaGraph2vec0.80850.80190.5095
PTE0.76240.75430.3781
RHINE0.76990.75710.3970
DBLP datasetMicro-F1Macro-F1NMI
DHNE---------
HAN0.83250.81410.3415
HeGAN0.94140.93640.7898
HERec0.92490.92140.3412
HIN2vec0.94950.94600.3924
Metapath2vec(APCPA)0.94830.94480.7786
MetaGraph2vec0.91380.90930.6136
PTE0.93350.93010.3280
RHINE0.93600.93160.7356

HAN uses the dataset without features.

Future work

We will use the dgl as our backend. And the OpenHINE will not be updated. We will be dedicated in building the new toolkit OpenHGNN, which is a high-level package built on top of DGL. It will have Better Extensibility, Better Encapsulation and More Effiencient.