Spec-Zone.ru › TensorFlow

tf.feature_column.indicator_column

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

Warning: tf.feature_column is not recommended for new code. Instead, feature preprocessing can be done directly using either Keras preprocessing layers or through the one-stop utility tf.keras.utils.FeatureSpace built on top of them. See the migration guide for details.

View aliases

Compat aliases for migration

See Migration 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
Deprecated: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use Keras preprocessing layers instead, either directly or via the tf.keras.utils.FeatureSpace utility. Each of tf.feature_column.* has a functional equivalent in tf.keras.layers for feature preprocessing when training a Keras model.
  • For DNN model, indicator_column can be used to wrap any categorical_column_* (e.g., to feed to DNN). Consider to Use embedding_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) to linear_model. See linear_model for details.

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.
Raises
ValueError If categorical_column is not CategoricalColumn type.

© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/feature_column/indicator_column

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API