tf.contrib.learn.Estimator.__init__(model_fn=None, model_dir=None, config=None, params=None, feature_engineering_fn=None)
Constructs an Estimator instance.
Args:
-
model_fn
: Model function, takes features and targets tensors or dicts of tensors and returns predictions and loss tensors. Supports next three signatures for the function:(features, targets) -> (predictions, loss, train_op)
(features, targets, mode) -> (predictions, loss, train_op)
(features, targets, mode, params) -> (predictions, loss, train_op)
Where
-
features
are singleTensor
ordict
ofTensor
s (depending on data passed tofit
), -
targets
areTensor
ordict
ofTensor
s (for multi-head models). If mode isModeKeys.INFER
,targets=None
will be passed. If themodel_fn
's signature does not acceptmode
, themodel_fn
must still be able to handletargets=None
. -
mode
represents if this training, evaluation or prediction. SeeModeKeys
. -
params
is adict
of hyperparameters. Will receive what is passed to Estimator inparams
parameter. This allows to configure Estimators from hyper parameter tunning.
model_dir
: Directory to save model parameters, graph and etc. This can also be used to load checkpoints from the directory into a estimator to continue training a previously saved model.config
: Configuration object.params
:dict
of hyper parameters that will be passed intomodel_fn
. Keys are names of parameters, values are basic python types.feature_engineering_fn
: Feature engineering function. Takes features and targets which are the output ofinput_fn
and returns features and targets which will be fed intomodel_fn
. Please checkmodel_fn
for a definition of features and targets.
Raises:
-
ValueError
: parameters ofmodel_fn
don't matchparams
.
Please login to continue.