Giter Club home page Giter Club logo

asne's Introduction

ASNE

Arxiv codebeat badge repo size benedekrozemberczki

An implementation of "Attributed Social Network Embedding". ASNE is a graph embedding algorithm which learns an embedding of nodes and fuses the node representations with node attributes. The procedure places nodes in an abstract feature space where information aboutfrist order proximity is preserved and attributes of a node are also part of the representation. ASNE learns the joint feature-proximal representations using a probabilistic factorization model. In our implementation we assumed that the proximity matrix used in the approximation is sparse, hence the solution runtime can be linear in the number of edges. The model assumes that the node-feature matrix is sparse. Compared to other implementations this specific version has several advantages. Specifically:

  1. Stores the feature matrix as a sparse dictionary.
  2. Uses sparse matrix multiplication to speed up computations.

This repository provides an implementation for ASNE as described in the paper:

Attributed Social Network Embedding. Lizi Liao, Xiangnan He, Hanwang Zhang, Tat-Seng Chua IEEE Transactions on Knowledge and Data Engineering, 2018. https://arxiv.org/abs/1705.04969

A dense TensorFlow implementation is available [here].


Requirements

The codebase is implemented in Python 3.5.2 | Anaconda 4.2.0 (64-bit). Package versions used for development are just below.

networkx          2.4
tensorflow-gpu    1.12.0
tqdm              4.19.5
numpy             1.15.4
pandas            0.23.4
texttable         1.5.0
scipy             1.1.0
argparse          1.1.0

Datasets

The code takes an input graph in a csv file. Every row indicates an edge between two nodes separated by a comma. The first row is a header. Nodes should be indexed starting with 0. Sample graphs for the `Wikipedia Chameleons` and `Wikipedia Giraffes` are included in the `input/` directory.

The feature matrix is a **sparse binary** one it is stored as a json. Nodes are keys of the json and features are the values. For each node feature column ids are stored as elements of a list. The feature matrix is structured as:

{ 0: [0, 1, 38, 1968, 2000, 52727],
  1: [10000, 20, 3],
  2: [],
  ...
  n: [2018, 10000]}

Options

Learning of the embedding is handled by the `asne_src/main.py` script which provides the following command line arguments.

Input and output options

  --edge-path     STR       Input graph path.           Default is `input/edges/chameleon_edges.csv`.
  --features-path STR       Input Features path.        Default is `input/features/chameleon_features.json`.
  --output-path   STR       Embedding path.             Default is `output/chameleon_asne.csv`.

Model options

  --node-embedding-dimensions      INT        Number of node embeding dimensions.           Default is 16.
  --feature-embedding-dimensions   INT        Number of feature embeding dimensions.        Default is 16.
  --batch_size                     INT        Batch size for gradient descent.              Default is 64.
  --epochs                         INT        Number of training epochs.                    Default is 10.
  --alpha                          FLOAT      Matrix mixing parameter for embedding.        Default is 1.0.
  --negative_samples               INT        Number of negative samples.                   Default is 10.

Examples

The following commands learn a graph embedding and write the embedding to disk. The node representations are ordered by the ID.

Creating an ASNE embedding of the default dataset with the default hyperparameter settings. Saving the embedding at the default path.

python asne_src/main.py

Creating an ASNE embedding of the default dataset with 2x128 dimensions.

python asne_src/main.py --node-embedding-dimensions 128  --feature-embedding-dimensions 128

Creating an ASNE embedding of the default dataset with asymmetric mixing.

python asne_src/main.py --batch_size 512

Creating an embedding of another structured dataset the Wikipedia Giraffes. Saving the output in a custom folder.

python asne_src/main.py --edge-path input/edges/giraffe_edges.csv --features-path input/features/giraffe_features.json --output-path output/giraffe_asne.csv

License


asne's People

Contributors

benedekrozemberczki avatar rietesh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

asne's Issues

About datasets

Excuse me, can you provide the URL of the data set?Thank you very much.

Some misunderstandings

Hello, the author. I am very happy to find your implementation of the ASNE method on github, but I have a question. The illustrations in your readme file are not in the article. Excuse me, this part is not your own mistake. I hope to get a reply in time. Thank you

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.