Skip to content

Feature_column to surport weighted_categorical_column in sequence; and sequence or normal categorical_column in shared_embeddings. #33640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dulm opened this issue Oct 23, 2019 · 1 comment
Assignees
Labels
comp:keras Keras related issues TF 2.0 Issues relating to TensorFlow 2.0 type:feature Feature requests

Comments

@dulm
Copy link

dulm commented Oct 23, 2019

Please make sure that this is a feature request. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:feature_template

System information

  • TensorFlow version (you are using): 2.0
  • Are you willing to contribute it (Yes/No): No

Describe the feature and the current behavior/state.
for example:

weighted_categorical_column in sequence:

import tensorflow as tf
from tensorflow.python.feature_column.feature_column_v2 import SequenceCategoricalColumn

batch_tensor_dict = {'dog': [[-1,-1],[1,1],[2,-1],[0,1]],
                     'dog_weight': [[0.0,0.0],[1.0,2.0],[3.0,0.0],[4.0,5.0]]
                     }

fc_cat_dog = tf.feature_column.categorical_column_with_identity(key='dog',num_buckets=3)
fc_wei_dog = tf.feature_column.weighted_categorical_column(fc_cat_dog, 'dog_weight')

seq_dog = SequenceCategoricalColumn(fc_wei_dog)
seq_dog2 = tf.feature_column.sequence_categorical_column_with_identity('dog', 3)

ind_dog = tf.feature_column.indicator_column(seq_dog)
input_layer = tf.keras.experimental.SequenceFeatures([ind_dog])
seq_input, seq_len = input_layer(batch_tensor_dict)
seq_len_mask = tf.sequence_mask(seq_len)

print(seq_input)
pass

sequence or normal categorical_column in shared_embeddings:

import tensorflow as tf
import tensorflow.feature_column as fc


batch_tensor_dict = {'item_id': [-1,1,2,0],
                     'history_item_id_list': [[-1,-1],[1,1],[2,-1],[0,1]]
                     }

fc_cat_item_id = fc.categorical_column_with_identity('item_id', 3)
fc_seq_cat_history_item_id_list = fc.sequence_categorical_column_with_identity('history_item_id_list', 3)

fc_shared_emb_cols = fc.shared_embeddings(categorical_columns=[fc_cat_item_id, fc_seq_cat_history_item_id_list])

tf.keras.experimental.SequenceFeatures and tf.keras.layers.DenseFeatures both are not suitable for fc_shared_emb_cols.

Will this change the current api? How?

Who will benefit with this feature?

Any Other info.

@oanush oanush self-assigned this Oct 24, 2019
@oanush oanush added comp:keras Keras related issues TF 2.0 Issues relating to TensorFlow 2.0 type:feature Feature requests labels Oct 24, 2019
@oanush oanush assigned ymodak and unassigned oanush Oct 24, 2019
@ymodak ymodak assigned tanzhenyu and unassigned ymodak Oct 25, 2019
@tanzhenyu
Copy link
Contributor

Feature column support is currently not in our roadmap. We have been putting every resource on migrating to Keras preprocessing layers. I think your use case can be supported by tf.RaggedTensor + IndexLookup layer + Embedding layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:keras Keras related issues TF 2.0 Issues relating to TensorFlow 2.0 type:feature Feature requests
Projects
None yet
Development

No branches or pull requests

4 participants