GithubHelp home page GithubHelp logo

helloybz / deepwalk-clone Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.59 MB

My implementation of Deepwalk in PyTorch

Home Page: https://helloybz.github.io/Deepwalk-Clone

License: MIT License

Python 100.00%
clone-coding node-embedding graph-representation-learning neighborhood-reconstruction-method random-walk-embedding pytorch-implementations deepwalk

deepwalk-clone's Introduction

Deepwalk - Clone

Clone implementation of deepwalk paper in PyTorch.

Install

Requirements:

  • python >= 3.9

Commmand:

pip install git+https://github.com/helloybz/deepwalk-clone.git

Usage

deepwalk --data_root PATH --output_root PATH --config_file PATH [--gpu] [--checkpoint_period=0 INT]

--data_root is supposed to be a directory which contains at least 2 files, V and E.
V contains list of node ids separated by \n.
E contains list of pairs of node id, separated by \n.
The pair of node should has a form like [source_node_id]\t[target_node_id.

Example

data_root/V

1
2
3
4
5

data_root/E

1\t2
1\t4
2\t5
3\t1

Config file

All of the hyper-parameters of deepwalk is controlled in this yaml file.
Below is an example of the config file.

n_dims: 128 # referred as d in the paper.
random_walker:
  steps_per_walk: 40 # referred as t in the paper.
  walks_per_node: 80 # referred as r in the paper.
skipgram:
  lr: 0.025
  window_size: 10 # referred as w in the paper.

Experiments

CORA dataset, a citation network, is used.
Identical hyper parameters introduced in the paper are used to both the original Deepwalk and the cloned Deepwalk.\

  • 128 dimensions
  • 40 steps per walk
  • 80 walks per node
  • 10 window size (10+10+1 for both directions.)

Loss graph

loss_for_80_epochs

Multi-Label Classification

  • Logistic regression is used as classifier.
  • Train:Test ratio varies from 1:9 to 9:1.
  • Metrics are averaged after 10 runs.
  • There are 7 classes in CORA dataset.

Micro F1

Column name means the percentage of train split.

Method 10% 20% 30% 40% 50% 60% 70% 80% 90%
Deepwalk-Clone 0.219 0.242 0.282 0.335 0.347 0.342 0.360 0.377 0.352
Deepwalk 0.200 0.206 0.215 0.223 0.213 0.236 0.242 0.256 0.247

Macro F1

Column name means the percentage of train split.

Method 10% 20% 30% 40% 50% 60% 70% 80% 90%
Deepwalk-Clone 0.411 0.421 0.427 0.457 0.478 0.468 0.477 0.511 0.454
Deepwalk 0.135 0.138 0.144 0.132 0.122 0.136 0.128 0.125 0.108

deepwalk-clone's People

Contributors

helloybz avatar

Watchers

 avatar

deepwalk-clone's Issues

Track losses

  • Track losses for every iteration and write them to a file as json.

Fix package name in help messages.

usage: DeepWalk-Clone [-h] [--data_root DATA_ROOT] [--config_file CONFIG_FILE] [--output_root OUTPUT_ROOT] [--checkpoint_period CHECKPOINT_PERIOD] [--gpu]

optional arguments:
  -h, --help            show this help message and exit
  --data_root DATA_ROOT
                        Path to the data root directory.
  --config_file CONFIG_FILE
                        Path to the config file.
  --output_root OUTPUT_ROOT
                        Path to the output root directory.
  --checkpoint_period CHECKPOINT_PERIOD
                        Period of making checkpoint in epoch. 0 for no checkpoints.
  --gpu

Change 'Deepwalk-Clone' into 'deepwalk'

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.