View source on GitHub
|
Counts the number of episodes in the environment.
Inherits From: PyStepMetric, PyMetric
tf_agents.metrics.py_metrics.NumberOfEpisodes(
name: Text = 'NumberOfEpisodes'
)
Attributes |
|---|
prefix
summary_op
summary_placeholder
Methods
aggregate
@staticmethodaggregate( metrics: Sequence[tf_agents.metrics.py_metric.PyMetricType] ) ->tf_agents.typing.types.Float
Aggregates a list of metrics.
The default behaviour is to return the average of the metrics.
| Args |
|---|
metrics
| Returns | |
|---|---|
| The result of aggregating this metric. |
call
call(
trajectory: tf_agents.trajectories.Trajectory
)
Processes a trajectory to update the metric.
| Args |
|---|
trajectory
log
log()
reset
reset()
Resets internal stat gathering variables used to compute the metric.
result
result() -> np.int64
Evaluates the current value of the metric.
tf_summaries
tf_summaries(
train_step: tf_agents.typing.types.Int = None,
step_metrics: Sequence[tf_agents.metrics.py_metric.MetricType] = ()
) -> tf.Operation
Build TF summary op and placeholder for this metric.
To execute the op, call py_metric.run_summaries.
| Args |
|---|
train_step
step_metrics
| Returns | |
|---|---|
| The summary op. |
| Raises |
|---|
RuntimeError
ValueError
__call__
__call__(
*args
)
Method to update the metric contents.
To change the behavior of this function, override the call method.
Different subclasses might use this differently. For instance, the PyStepMetric takes in a trajectory, while the CounterMetric takes no parameters.
| Args |
|---|
*args
View source on GitHub