shenweichen / DeepCTR

Easy-to-use,Modular and Extendible package of deep-learning based CTR models .
https://deepctr-doc.readthedocs.io/en/latest/index.html
Apache License 2.0
7.58k stars 2.21k forks source link

请教下如何feature_column处理类似VarLenSparseFeat这种序列特征 #369

Open zhoujiang2013 opened 3 years ago

zhoujiang2013 commented 3 years ago

如何feature_column处理类似VarLenSparseFeat这种序列特征,使用tfrecord的example中只看懂了 SparseFeat、DenseFeat的使用:

for i, feat in enumerate(sparse_features):
    dnn_feature_columns.append(tf.feature_column.embedding_column(
        tf.feature_column.categorical_column_with_identity(feat, 1000), 4))
    linear_feature_columns.append(tf.feature_column.categorical_column_with_identity(feat, 1000))
for feat in dense_features:
    dnn_feature_columns.append(tf.feature_column.numeric_column(feat))
    linear_feature_columns.append(tf.feature_column.numeric_column(feat))
skriser commented 2 years ago

解决了么

Henry199898 commented 2 years ago

先对[batch, max_len]中每个单词查embedding向量为[batch, max_len, embedding_dim],然后对该序列池化(['sum', 'mean', 'max'])得到最后的varlen向量[batch, embedding_dim]. 我理解是这样