Skip to content

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

@dulm

Description

@dulm

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.

Metadata

Metadata

Assignees

Labels

TF 2.0Issues relating to TensorFlow 2.0comp:kerasKeras related issuestype:featureFeature requests

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions