A layer that produces a dense
Tensor based on given
tf.compat.v2.keras.layers.DenseFeatures( feature_columns, trainable=True, name=None, **kwargs )
Generally a single example in training data is described with FeatureColumns. At the first layer of the model, this column oriented data should be converted to a single
This layer can be called multiple times with different features.
This is the V2 version of this layer that uses name_scopes to create variables instead of variable_scopes. But this approach currently lacks support for partitioned variables. In that case, use the V1 version instead.
price = numeric_column('price') keywords_embedded = embedding_column( categorical_column_with_hash_bucket("keywords", 10K), dimensions=16) columns = [price, keywords_embedded, ...] feature_layer = DenseFeatures(columns) features = tf.io.parse_example(..., features=make_parse_example_spec(columns)) dense_tensor = feature_layer(features) for units in [128, 64, 32]: dense_tensor = tf.keras.layers.Dense(units, activation='relu')(dense_tensor) prediction = tf.keras.layers.Dense(1)(dense_tensor)
| || An iterable containing the FeatureColumns to use as inputs to your model. All items should be instances of classes derived from |
| ||Boolean, whether the layer's variables will be updated via gradient descent during training.|
| ||Name to give to the DenseFeatures.|
| ||Keyword arguments to construct a layer.|
| || if an item in |
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.