tensorflow-DeepFM icon indicating copy to clipboard operation
tensorflow-DeepFM copied to clipboard

Why are categorical data all set 1?

Open Superhors opened this issue 6 years ago • 5 comments

If do so,what`s the meaning of categorical data?

Superhors avatar Nov 08 '18 07:11 Superhors

因为连续值被离散化了,所有特征都是离散化的。当然,你也可以不设定为1,不必局限于example

sudongxiang avatar Nov 21 '18 11:11 sudongxiang

image #这里的逻辑还是没懂,为什么离散型数据全部为1#......已经了解了

killoceaner avatar Mar 28 '19 06:03 killoceaner

image #这里的逻辑还是没懂,为什么离散型数据全部为1#......已经了解了 DFI存的是特征的index,DFV存的是特征的值

ShampooWoo avatar Apr 17 '19 05:04 ShampooWoo

因为这里有 numerical feature, 所以对于整个输入的 vector, 不能直接 tf.nn.embedding_lookup 就完事了, 因为对于 numerical feature 没法做到真正的 embedding. 因此, 这里的做法是, 拿到 tf.nn.embedding_lookup 之后, 和输入的 vector 直接相乘一下. 对于 categorical feature, 我们当然是希望保持 embedding 对应索引的那个 vector. 所以就直接置为 1 了, 这个主要是代码的 trick 吧.

Lirunhua avatar Dec 31 '19 07:12 Lirunhua

If do so,what`s the meaning of categorical data?

please note this line(DeepFM.py, around line 88) self.y_first_order = tf.reduce_sum(tf.multiply(self.y_first_order, feat_value), 2) # None * F

It's not for categorical feature, it's for numercal feature

Lirunhua avatar Dec 31 '19 08:12 Lirunhua