Git Product home page Git Product logo

beside's Introduction

``Bridge” Enhanced Signed Directed Network Embedding

Introduction

This repository provides a reference implementation of BESIDE as described in the paper:

``Bridge” Enhanced Signed Directed Network Embedding.
Yiqi Chen, Tieyun Qian, Huan Liu and Ke Sun.
Conference on Information and Knowledge Management, 2018.

Basic Usage

Example

1.preprocess public dataset(download from here):

python preprocess_data.py slashdot ./original_dataset/soc-sign-Slashdot090221.txt ./dataset/soc-sign-Slashdot090221.txt.map ./dataset/soc-sign-Slashdot090221.txt.map.train ./dataset/soc-sign-Slashdot090221.txt.map.test ./dataset/soc-sign-Slashdot090221.txt.map.nodes

2.train + test model:

python BESIDE_train.py slashdot tri_sta 20 100 ./dataset/soc-sign-Slashdot090221.txt.map.train ./dataset/soc-sign-Slashdot090221.txt.map.test ./dataset/soc-sign-Slashdot090221.txt.map.nodes

test results are written in log/<some-name>.log

Options

1.preprocess

Usage:
python preprocess_data.py <dataset_choose> <dataset_fpath_origin> <dataset_fpath_output> <dataset_train_fpath> <dataset_test_fpath> <dataset_nodes_fpath>

arguments:
dataset_choose: select a name for your dataset (e.g. slashdot, epinions, wikirfa)
dataset_fpath_origin: input dataset file path
dataset_fpath_output: output dataset file path
dataset_train_fpath: output train file path
dataset_test_fpath: output test file path
dataset_nodes_fpath: output nodes id file path

2.train + test (link sign prediction)

Usage: 
python BESIDE_train.py <dataset_choose> <mode_choose> <emb_dim> <epoch_num> <dataset_train_fpath> <dataset_test_fpath> <dataset_nodes_fpath>

arguments:
dataset_choose: select a name for your dataset (e.g. slashdot, epinions, wikirfa)
mode_choose: three mode, [tri_sta, tri, sta]
emb_dim: embedding dimension for nodes
epoch_num: train epoch number
dataset_train_fpath: train file path (you can use preprocess_data to generate it), edgelist format
dataset_test_fpath: test file path (you can use preprocess_data to generate it), edgelist format
dataset_nodes_fpath: nodes id file path (you can use preprocess_data to generate it)

3.test(status comparison)

Usage: 
python status_comp.py <method_choose> <dataset_choose> <dataset_train_fpath> <dataset_test_fpath> <dataset_nodes_fpath> (<BESIDE_para_fpath>)

arguments:
method choose: select model method name ([BESIDE_tri_sta, BESIDE_sta, pagerank])
dataset_choose: select a name for your dataset (e.g. slashdot, epinions, wikirfa)
dataset_train_fpath: train file path (you can use preprocess_data to generate it), edgelist format
dataset_test_fpath: test file path (you can use preprocess_data to generate it), edgelist format
dataset_nodes_fpath: nodes id file path (you can use preprocess_data to generate it)
BESIDE_para_fpath: BESIDE model parameters file path

example:
python status_comp.py BESIDE_tri_sta slashdot ./dataset/soc-sign-Slashdot090221.txt.map.train ./dataset/soc-sign-Slashdot090221.txt.map.test ./dataset/soc-sign-Slashdot090221.txt.map.nodes ./emb/example.emb.ep10

Input

edgelist format of signed directed network: <node1_id> <node2_id> <sign>

detail can be drawn from here.

Output

test results are in log/ directory;

model parameters are saved in pickle format, you can load it following read_emb_para_example.py.

Requirement

python3 (3.5.3)
tensorflow >= 1.1.0
networkx >= 2.0
sklearn >= 0.19.1
numpy >= 1.14.5

beside's People

Contributors

yqc01 avatar farseer002 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.