rixwew / pytorch-fm

Factorization Machine models in PyTorch
MIT License
1.04k stars 225 forks source link

FeatureEmbedding Implementation #4

Closed p-null closed 5 years ago

p-null commented 5 years ago

Hi, congrats on your great work! I was wondering why you add a offset before embedding?

https://github.com/rixwew/pytorch-fm/blob/a4cfa99aa23147b15a0df065553567dba859246d/torchfm/layer.py#L27

As I am looking at the implementation of xDeepFM, I didn't find the corresponding code in original tensorflow implementation.

Drone-Banks commented 5 years ago

The feature value of different filed all start from 1, but they are all embeded into the same matrix, so the offsets is needed.

p-null commented 5 years ago

The feature value of different filed all start from 1, but they are all embeded into the same matrix, so the offsets is needed.

Oh yeah. Thanks for replying!

MogicianXD commented 4 years ago

However, speed can be slower. Adding offset in preprocessing may be a better choice?