Giter Club home page Giter Club logo

node2vec's Introduction

node2vec

This is a Python3 implementation of Stanford University's node2vec model

General Methodology of node2vec

  1. Compute transition probabilities for all the nodes. (2nd order Markov chain)

  2. Generate biased walks based on probabilities

  3. Generate embeddings with SGD

Pre-requisites

Install pre-reqs by running the following command: pip3 install -r req.txt

Usage

To run node2vec with default arguments, execute the following command from the home directory: python3 src/main.py

A full list of command line arguments are shown by entering:

python3 src/main.py -h
usage: main.py [-h] [--input INPUT] [--output OUTPUT] [--p P] [--q Q]
               [--walks WALKS] [--length LENGTH] [--d D] [--window WINDOW]
               [--workers WORKERS] [--directed]

node2vec implementation

optional arguments:
  -h, --help         show this help message and exit
  --input INPUT      Path for input edgelist
  --output OUTPUT    Path for saving output embeddings
  --p P              Return parameter
  --q Q              In-out parameter
  --walks WALKS      Walks per node
  --length LENGTH    Length of each walk
  --d D              Dimension of output embeddings
  --window WINDOW    Window size for word2vec
  --workers WORKERS  Number of workers to assign for random walk and word2vec
  --directed         Flad to specify if graph is directed. Default is undirected. 

Note: Zachary's Karate club network is used by default if no argument is provided for the input flag. Do check the default values in main.py

Example Usage:

To generate embeddings for Zachary's Karate club network with custom arguments, the following can be used

python3 src/main.py --p 0.4 --q 1 --walks 20 --length 80 --d 256

Consolidated report with performance benchmarks are included in node2vec_report.pdf

References:

node2vec: Scalable Feature Learning for Networks - Aditya Grover, Jure Leskovec

Contact me at [email protected]

node2vec's People

Contributors

apoorvavinod avatar

Stargazers

 avatar

Watchers

 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.