# tf.estimator.EvalSpec

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/estimator/tree/master/tensorflow_estimator/python/estimator/training.py#L200-L293) |

Configuration for the "eval" part for the `train_and_evaluate` call. (deprecated)

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.estimator.EvalSpec`](https://www.tensorflow.org/api_docs/python/tf/estimator/EvalSpec)

<br />

    tf.estimator.EvalSpec(
        input_fn,
        steps=100,
        name=None,
        hooks=None,
        exporters=None,
        start_delay_secs=120,
        throttle_secs=600
    )

> [!WARNING]
> **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.keras instead.

`EvalSpec` combines details of evaluation of the trained model as well as its
export. Evaluation consists of computing metrics to judge the performance of
the trained model. Export writes out the trained model on to external
storage.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `input_fn` | A function that constructs the input data for evaluation. See [Premade Estimators](https://tensorflow.org/guide/premade_estimators#create_input_functions) for more information. The function should construct and return one of the following: <br /> - A 'tf.data.Dataset' object: Outputs of `Dataset` object must be a tuple (features, labels) with same constraints as below. - A tuple (features, labels): Where features is a `Tensor` or a dictionary of string feature name to `Tensor` and labels is a `Tensor` or a dictionary of string label name to `Tensor`. |
| `steps` | Int. Positive number of steps for which to evaluate model. If `None`, evaluates until `input_fn` raises an end-of-input exception. See [`Estimator.evaluate`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/compat/v1/estimator/Estimator#evaluate) for details. |
| `name` | String. Name of the evaluation if user needs to run multiple evaluations on different data sets. Metrics for different evaluations are saved in separate folders, and appear separately in tensorboard. |
| `hooks` | Iterable of `tf.train.SessionRunHook` objects to run during evaluation. |
| `exporters` | Iterable of `Exporter`s, or a single one, or `None`. `exporters` will be invoked after each evaluation. |
| `start_delay_secs` | Int. Start evaluating after waiting for this many seconds. |
| `throttle_secs` | Int. Do not re-evaluate unless the last evaluation was started at least this many seconds ago. Of course, evaluation does not occur if no new checkpoints are available, hence, this is the minimum. |

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If any of the input arguments is invalid. |
| `TypeError` | If any of the arguments is not of the expected type. |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `input_fn` | A `namedtuple` alias for field number 0 |
| `steps` | A `namedtuple` alias for field number 1 |
| `name` | A `namedtuple` alias for field number 2 |
| `hooks` | A `namedtuple` alias for field number 3 |
| `exporters` | A `namedtuple` alias for field number 4 |
| `start_delay_secs` | A `namedtuple` alias for field number 5 |
| `throttle_secs` | A `namedtuple` alias for field number 6 |

<br />