# tf_agents.bandits.metrics.tf_metrics.SuboptimalArmsMetric

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/bandits/metrics/tf_metrics.py#L84-L126) |

Computes the number of suboptimal arms with respect to a baseline.

Inherits From: [`TFStepMetric`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/metrics/tf_metric/TFStepMetric)

    tf_agents.bandits.metrics.tf_metrics.SuboptimalArmsMetric(
        baseline_action_fn: Callable[[https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Tensor], https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Tensor],
        name: Optional[Text] = 'SuboptimalArmsMetric',
        dtype: float = tf.float32
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `baseline_action_fn` | function that computes the action used as a baseline for computing the metric. |
| `name` | (str) name of the metric |
| `dtype` | dtype of the metric value. |

<br />

## Methods

### `call`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/bandits/metrics/tf_metrics.py#L109-L123)

    call(
        trajectory
    )

Update the metric value.

<br />

<br />

<br />

| Args ||
|---|---|
| `trajectory` | A tf_agents.trajectory.Trajectory |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| The arguments, for easy chaining. ||

<br />

### `init_variables`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L61-L75)

    init_variables()

Initializes this Metric's variables.

Should be called after variables are created in the first execution
of `__call__()`. If using graph execution, the return value should be
`run()` in a session before running the op returned by `__call__()`.
(See example above.)

<br />

<br />

<br />

| Returns ||
|---|---|
| If using graph execution, this returns an op to perform the initialization. Under eager execution, the variables are reset to their initial values as a side effect and this function returns None. ||

<br />

### `reset`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L53-L55)

    reset()

Resets the values being tracked by the metric.

### `result`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/bandits/metrics/tf_metrics.py#L125-L126)

    result()

Computes and returns a final value for the metric.

### `tf_summaries`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L94-L126)

    tf_summaries(
        train_step=None, step_metrics=()
    )

Generates summaries against train_step and all step_metrics.

<br />

<br />

<br />

| Args ||
|---|---|
| `train_step` | (Optional) Step counter for training iterations. If None, no metric is generated against the global step. |
| `step_metrics` | (Optional) Iterable of step metrics to generate summaries against. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A list of summaries. ||

<br />

### `__call__`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L82-L92)

    __call__(
        *args, **kwargs
    )

Returns op to execute to update this metric for these inputs.

Returns None if eager execution is enabled.
Returns a graph-mode function if graph execution is enabled.

<br />

<br />

<br />

| Args ||
|---|---|
| `*args` | <br /> <br /> |
| `**kwargs` | A mini-batch of inputs to the Metric, passed on to `call()`. |

<br />