TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

tf.feature_column.indicator_column

TensorFlow 1 version View source on GitHub

Represents multi-hot representation of given categorical column.

Aliases:

  • tf.compat.v1.feature_column.indicator_column
  • tf.compat.v2.feature_column.indicator_column
tf.feature_column.indicator_column(categorical_column)

Used in the tutorials:

name = indicator_column(categorical_column_with_vocabulary_list(
    'name', ['bob', 'george', 'wanda'])
columns = [name, ...]
features = tf.io.parse_example(..., features=make_parse_example_spec(columns))
dense_tensor = input_layer(features, columns)

dense_tensor == [[1, 0, 0]]  # If "name" bytes_list is ["bob"]
dense_tensor == [[1, 0, 1]]  # If "name" bytes_list is ["bob", "wanda"]
dense_tensor == [[2, 0, 0]]  # If "name" bytes_list is ["bob", "bob"]

Args:

  • categorical_column: A CategoricalColumn which is created by categorical_column_with_* or crossed_column functions.

Returns:

An IndicatorColumn.