Code Monkey home page Code Monkey logo

eges's Introduction

DGL & Pytorch implementation of Enhanced Graph Embedding with Side information (EGES)

Version

dgl==0.6.1, torch==1.9.0

Paper

Billion-scale Commodity Embedding for E-commerce Recommendation in Alibaba:

https://arxiv.org/pdf/1803.02349.pdf

https://arxiv.org/abs/1803.02349

Dataset

https://wx.jdcloud.com/market/jdata/list/17

How to run

Create folder named data. Download two csv files from here into the data folder.

Run command: python main.py with default configuration, and the following message will shown up:

Using backend: pytorch
Num skus: 1006, num brands: 221, num shops: 308, num cates: 55
Epoch 00000 | Step 00000 | Step Loss 0.8452 | Epoch Avg Loss: 0.8452
Evaluate link prediction AUC: 0.5557
Epoch 00001 | Step 00000 | Step Loss 0.7293 | Epoch Avg Loss: 0.7293
Evaluate link prediction AUC: 0.5774
Epoch 00002 | Step 00000 | Step Loss 0.7157 | Epoch Avg Loss: 0.7157
Evaluate link prediction AUC: 0.5764
...
Epoch 00028 | Step 00000 | Step Loss 0.7105 | Epoch Avg Loss: 0.7105
Evaluate link prediction AUC: 0.5880
Epoch 00029 | Step 00000 | Step Loss 0.7115 | Epoch Avg Loss: 0.7115
Evaluate link prediction AUC: 0.5914

The AUC of link-prediction task on test graph is computed after each epoch is done.

Reference

https://github.com/nonva/eges

https://github.com/wangzhegeek/EGES.git

eges's People

Contributors

wang-yu-qing avatar

Stargazers

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

Watchers

 avatar

eges's Issues

解码器decoder

skus = set([sku for s in sessions for sku in s])
encoder = {y: x for x, y in enumerate(skus)}
decoder = [y for x, y in enumerate(skus)]

sku 是set, 编码器和解码的 index不是一个啊。。。这个地方有问题吧???
skus = sorted(set([sku for s in sessions for sku in s]))

是不是应该这样??

获取 encoded id 逻辑是否有误

EGES/utils.py

Lines 107 to 116 in 470876a

sku_id = encode_id(sku_encoder,
sku_decoder,
sku_raw_id,
sku_id)
# add to user clicks
try:
user_clicks[user_id].append((sku_id, action_time))
except KeyError:
user_clicks[user_id] = [(sku_id, action_time)]

若raw_id在之前出现过,返回的encoded id(自增)直接作为 raw id 的编码后的id 是否是 错误的

when convert to dgl graph, new item'id

Hi, I have a question about newtorkx graph and dgl graph.

The number of items is 33434. (0 ~ 33433) after encoding.
These items are entered into newtorkx's graph with some dropped items due to session length. so # of networkx's item is 14651.

that networkx's graph is transformed to dgl's graph. the items are relabeled from 0 ~ 14650. that dgl graph is 'train_g'.

dataloader get train_g's items like range(14651). so the dataloader's output is 0 ~ 14650.

but, in EGES model, item embedding is set by nn.Embedding(33434, 16) though dataloader's output is 0 ~ 14650.

is that right? but it works well.....

only 0 ~ 14650 index embeddings are used in embedding matrix, right?

建图

for i in range(len(session) - 1):
edge = str(session[i]) + "," + str(session[i + 1])
try:
graph[edge] += 1
except KeyError:
graph[edge] = 1

构件图的时候使用的有向图吧?针对sku浏览行为使用无向图是不是更好些??
毕竟看了A洗发水再看B洗发水 和 先看B洗发水再看A洗发水 对用户来说没有任何区别
是不是这样才对????
for i in range(len(session) - 1):
# Ensure the smaller ID comes first for undirected edges
edge = tuple(sorted([session[i], session[i + 1]]))
try:
graph[edge] += 1
except KeyError:
graph[edge] = 1

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.