Coder Social home page Coder Social logo

graph_star's Introduction

Graph Star

基本的に本家の実装を使用しています.

https://github.com/graph-star-team/graph_star

本家の実装からの差分は

  1. 自分のデータを学習できる形に変形data.py
  2. sansan データで Link Prediction モデルを作成する sansan_lp.py
  3. 学習データからそれぞれの辺の Link Prediction Score を出す use_score.py

です.

学習データのサイズとして node_num 10^5, edge_num 10^6 程度を想定しています.

GPU は gcp をお借りしました.メモリ数は16Gでした.

実行準備

$ python --version
3.6.6
$ python -m venv venv
$ source venv/bin/avtivate
$ pip install -r requirement.txt

ほか pytorch_geometric の install などは下記 URL を参考にしてください

https://github.com/rusty1s/pytorch_geometric#installation

CUDA の install も必要かと思います.

Make Own Dataset

準備

  • 頂点を 0-indexに置き換えられたcsvファイルをdata/rawdata/配下に用意

  • 頂点数の確認.

data.py の書き換え

# node_num
num_nodes = ####

# raw_csv_path 
edge_df = pd.read_csv('data/raw_data/filename.csv')

# node column_name_1,column_name_2
edge_company = torch.tensor(edge_df[["column_name_1","column_name_2"]].values, dtype=torch.long)

実行

$ python data.py

処理が終わってるデータとしてsansan_2r.pklbig_company.pklを用意してます.

sansan_2r.pkl :sansan から距離2のデータセット big_company.pkl :会社,Userの2部グラフデータセットで次数でデータセットを減らしています.

Make Model

$ bash sansan_lp.sh 
$ bash big_company_sansan.sh 

引数の詳細は

https://github.com/graph-star-team/graph_star#options

とほとんど同じですが,modelnameだけ追加しております.

User Model

$ python use_model.py

csvにtestデータのscoreと正解ラベルに保存されてます.

もくもく会で使用するデータセットを作成するとき

MOKUMOKU = True

sansan_all_egde.pkl :sansan から距離2のユーザに対する辺のデータ big_company_all_egde.pkl :sansan から距離2のユーザに対する辺のデータ

graph_star's People

Contributors

drumehiron avatar graph-star-team avatar khev 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.