Model Input Layer

Understand the purpose of using feature columns for the model's input layer.

We'll cover the following

Chapter Goals:

  • Aggregate the feature columns for the machine learning model’s input layer

A. The input layer

The reason we create feature columns for each of the input data features is so that we can easily make the input layer vector for the machine learning model. The input layer is simply the combination of the numeric, indicator, and embedding feature columns.

SizeCPI...Type......StoreDept
The input layer vector for the machine learning model. It is the combination of all the feature columns.

Using the functions from the three previous chapters, we can create the feature columns for the entire dataset. The function below, create_feature_columns does exactly that.

Press + to interact
import tensorflow as tf
def create_feature_columns(final_dataset):
feature_columns = []
add_numeric_columns(feature_columns)
add_indicator_columns(final_dataset, feature_columns)
add_embedding_columns(final_dataset, feature_columns)
return feature_columns
feature_columns = create_feature_columns(final_dataset)
print(feature_columns)

In chapter 8 of the Model Creation section, you’ll use the feature columns to actually create the model’s input layer.

Get hands-on with 1300+ tech skills courses.