In this recipe, we will use a pre-made dnn_regressor estimator. Let's get started and build and train a deep learning estimator model:
- We need to execute some steps before building an estimator neural network. First, we need to create a vector of feature names:
features_set <- setdiff(names(dummy_data_estimator), "target")
Here, we construct the feature columns according to the Estimator API. The feature_columns() function is a constructor for feature columns, which defines the expected shape of the input to the model:
feature_cols <- feature_columns( column_numeric(features_set))
- Next, we define an input function so that we can select feature and response variables:
estimator_input_fn <- function(data_,num_epochs = 1) ...