给出vocabulary_list=["kitchenware", "electronics", "sports"]
。我们可以使用tf.feature_column.categorical_column_with_vocabulary_list
来实现映射:
["kitchenware"] -> [1,0,0]
["electronics"] -> [0,1,0]
["sports"] -> [0,0,1]
但是我想将单词映射到单词ID,例如:
["kitchenware"] -> [0]
["electronics"] -> [1]
["sports"] -> [2]
是否有任何功能列可以实现这一目标?