tf.feature_column.indicator_column(categorical_column)
Defined in tensorflow/python/feature_column/feature_column_v2.py
.
Represents multi-hot representation of given categorical column.
For DNN model,
indicator_column
can be used to wrap anycategorical_column_*
(e.g., to feed to DNN). Consider to Useembedding_column
if the number of buckets/unique(values) are large.For Wide (aka linear) model,
indicator_column
is the internal representation for categorical column when passing categorical column directly (as any element in feature_columns) tolinear_model
. Seelinear_model
for details.
name = indicator_column(categorical_column_with_vocabulary_list(
'name', ['bob', 'george', 'wanda'])
columns = [name, ...]
features = tf.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
: ACategoricalColumn
which is created bycategorical_column_with_*
orcrossed_column
functions.
Returns:
An IndicatorColumn
.