Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

input_layer

Construct an Input Layer


Description

Returns a dense tensor as input layer based on given feature_columns. At the first layer of the model, this column oriented data should be converted to a single tensor.

Usage

input_layer(features, feature_columns, weight_collections = NULL,
  trainable = TRUE)

Arguments

features

A mapping from key to tensors. Feature columns look up via these keys. For example column_numeric('price') will look at 'price' key in this dict. Values can be a sparse tensor or tensor depends on corresponding feature column.

feature_columns

An iterable containing the FeatureColumns to use as inputs to your model. All items should be instances of classes derived from a dense column such as column_numeric(), column_embedding(), column_bucketized(), column_indicator(). If you have categorical features, you can wrap them with an column_embedding() or column_indicator().

weight_collections

A list of collection names to which the Variable will be added. Note that, variables will also be added to collections graph_keys()$GLOBAL_VARIABLES and graph_keys()$MODEL_VARIABLES.

trainable

If TRUE also add the variable to the graph collection graph_keys()$TRAINABLE_VARIABLES (see tf$Variable).

Value

A tensor which represents input layer of a model. Its shape is (batch_size, first_layer_dimension) and its dtype is float32. first_layer_dimension is determined based on given feature_columns.

Raises

  • ValueError: if an item in feature_columns is not a dense column.

See Also


tfestimators

Interface to 'TensorFlow' Estimators

v1.9.1
Apache License 2.0
Authors
JJ Allaire [aut], Yuan Tang [aut] (<https://orcid.org/0000-0001-5243-233X>), Kevin Ushey [aut], Kevin Kuo [aut, cre] (<https://orcid.org/0000-0001-7803-7901>), Daniel Falbel [ctb, cph], RStudio [cph, fnd], Google Inc. [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.