Premade and custom estimators share a common architecture: both aim to build a tf.estimator.EstimatorSpec object that fully defines the model to be run by tf.estimator.Estimator; the return value of any model_fn is, therefore, the Estimator specification.
The model_fn function follows this signature:
model_fn( features, labels, mode = None, params = None, config = None)
The function parameters are:
- features is the first item returned from input_fn
- labels is the second item returned from input_fn
- mode is the tf.estimator.ModeKeys object that specifies the status of the model, if it is in the training, evaluation, or prediction phase
- params is a dictionary of hyperparameters that can be used to tune the model easily
- config ...