MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / evaluate

Method evaluate

tensorflow/contrib/learn/python/learn/evaluable.py:46–119  ·  view source on GitHub ↗

Evaluates given model with provided evaluation data. Stop conditions - we evaluate on the given input data until one of the following: - If `steps` is provided, and `steps` batches of size `batch_size` are processed. - If `input_fn` is provided, and it raises an end-of-input

(self,
               x=None,
               y=None,
               input_fn=None,
               feed_fn=None,
               batch_size=None,
               steps=None,
               metrics=None,
               name=None,
               checkpoint_path=None,
               hooks=None)

Source from the content-addressed store, hash-verified

44
45 @abc.abstractmethod
46 def evaluate(self,
47 x=None,
48 y=None,
49 input_fn=None,
50 feed_fn=None,
51 batch_size=None,
52 steps=None,
53 metrics=None,
54 name=None,
55 checkpoint_path=None,
56 hooks=None):
57 """Evaluates given model with provided evaluation data.
58
59 Stop conditions - we evaluate on the given input data until one of the
60 following:
61 - If `steps` is provided, and `steps` batches of size `batch_size` are
62 processed.
63 - If `input_fn` is provided, and it raises an end-of-input
64 exception (`OutOfRangeError` or `StopIteration`).
65 - If `x` is provided, and all items in `x` have been processed.
66
67 The return value is a dict containing the metrics specified in `metrics`, as
68 well as an entry `global_step` which contains the value of the global step
69 for which this evaluation was performed.
70
71 Args:
72 x: Matrix of shape [n_samples, n_features...] or dictionary of many
73 matrices
74 containing the input samples for fitting the model. Can be iterator that
75 returns
76 arrays of features or dictionary of array of features. If set,
77 `input_fn` must
78 be `None`.
79 y: Vector or matrix [n_samples] or [n_samples, n_outputs] containing the
80 label values (class labels in classification, real numbers in
81 regression) or dictionary of multiple vectors/matrices. Can be iterator
82 that returns array of targets or dictionary of array of targets. If set,
83 `input_fn` must be `None`. Note: For classification, label values must
84 be integers representing the class index (i.e. values from 0 to
85 n_classes-1).
86 input_fn: Input function returning a tuple of:
87 features - Dictionary of string feature name to `Tensor` or `Tensor`.
88 labels - `Tensor` or dictionary of `Tensor` with labels.
89 If input_fn is set, `x`, `y`, and `batch_size` must be `None`. If
90 `steps` is not provided, this should raise `OutOfRangeError` or
91 `StopIteration` after the desired amount of data (e.g., one epoch) has
92 been provided. See "Stop conditions" above for specifics.
93 feed_fn: Function creating a feed dict every time it is called. Called
94 once per iteration. Must be `None` if `input_fn` is provided.
95 batch_size: minibatch size to use on the input, defaults to first
96 dimension of `x`, if specified. Must be `None` if `input_fn` is
97 provided.
98 steps: Number of steps for which to evaluate model. If `None`, evaluate
99 until `x` is consumed or `input_fn` raises an end-of-input exception.
100 See "Stop conditions" above for specifics.
101 metrics: Dict of metrics to run. If None, the default metric functions
102 are used; if {}, no metrics are used. Otherwise, `metrics` should map
103 friendly names for the metric to a `MetricSpec` object defining which

Calls

no outgoing calls