Closed omgteam closed 8 years ago
I figure out a simple way, define a IdenticalSparseColumn(_SparseColumn), and transform data into multi-column SparseTensor in data preparation
1 import tensorflow as tf
2 from tensorflow.python.framework import dtypes 3 from tensorflow.contrib.layers import feature_column 4 5 6 class IdenticalSparseColumn(feature_column._SparseColumn): 7 """Identical sparse column to support transformation in data layer""" 8 9 def new(cls, column_name, bucket_size, combiner="sum"): 10 11 return super(IdenticalSparseColumn, cls).new(cls, 12 column_name, 13 bucket_size=bucket_size, 14 combiner=combiner, 15 dtype=dtypes.int32) 16 17 def insert_transformed_feature(self, columns_to_tensors): 18 """Handles sparse column to id conversion.""" 19 columns_to_tensors[self] = columns_to_tensors[self.name]
and preprocessing data into SparseTensor
wide_n_deep model in paper [1] support embedding for users' installed app features. But in wide_n_deep.py and feature_column.py, I haven't find something about supporting embedding for users' installed app features, which trains embedding jointly for multi-columns. Do I miss anything? or misunderstanding
[1] Wide & Deep Learning for Recommender Systems @moonboots