tf.feature_column.indicator_column  |  TensorFlow v2.16.1 (original) (raw)

tf.feature_column.indicator_column

Stay organized with collections Save and categorize content based on your preferences.

Represents multi-hot representation of given categorical column. (deprecated)

View aliases

Compat aliases for migration

SeeMigration guide for more details.

tf.compat.v1.feature_column.indicator_column

tf.feature_column.indicator_column(
    categorical_column
)

Used in the notebooks

Used in the guide Used in the tutorials
Migrate `tf.feature_column`s to Keras preprocessing layers Classify structured data with feature columns Build a linear model with Estimators End to end example for BigQuery TensorFlow reader Preprocessing data with TensorFlow Transform
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 bycategorical_column_with_* or crossed_column functions.
Returns
An IndicatorColumn.
Raises
ValueError If categorical_column is not CategoricalColumn type.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.

Last updated 2024-04-26 UTC.