Metrics

check_metric_data

check_metric_data(y_pred, y_true)

built_metric

built_metric(fct, name, scope, collect)

Builds the metric function.

  • Args:
    • fct: the metric function to build.
    • name: operation name.
    • scope: operation scope.
    • collect: whether to collect this metric under the metric collection.

accuracy

accuracy(name='Accuracy', scope=None, collect=False)

Computes the accuracy.

An op that calculates mean accuracy: * y_pred are y_True are both one-hot encoded. (categorical accuracy) * y_pred are logits are binary encoded (and represented as int32). (binary accuracy)

  • Examples:
>>> input_data = placeholder(shape=[None, 784])
>>> y_pred = my_network(input_data) # Apply some ops
>>> y_true = placeholder(shape=[None, 10]) # Labels
>>> accuracy_op = accuracy(y_pred, y_true)
>>> # Calculate accuracy by feeding data X and labels Y
>>> accuracy_op = sess.run(accuracy_op, feed_dict={input_data: X, y_true: Y})
  • Args:

    • scope: scope to add the op to.
    • name: name of the op.
    • collect: add to metrics collection.
  • Returns: Float. The mean accuracy.


top_k

top_k(k=1, name='TopK', scope=None, collect=False)

top_k_op.

An op that calculates top-k mean accuracy.

  • Examples:
>>> input_data = placeholder(shape=[None, 784])
>>> y_pred = my_network(input_data) # Apply some ops
>>> y_true = placeholder(shape=[None, 10]) # Labels
>>> top3_op = top_k(y_pred, y_true, 3)

>>> # Calculate Top-3 accuracy by feeding data X and labels Y
>>> top3_accuracy = sess.run(top3_op, feed_dict={input_data: X, y_true: Y})
  • Args:

    • k: int. Number of top elements to look at for computing precision.
    • scope: scope to add the op to.
    • name: name of the op.
    • collect: add to metrics collection.
  • Returns: Float. The top-k mean accuracy.


std_error

std_error(name='StandardError', scope=None, collect=False)

standard error.

An op that calculates the standard error.

  • Examples:
>>> input_data = placeholder(shape=[None, 784])
>>> y_pred = my_network(input_data) # Apply some ops
>>> y_true = placeholder(shape=[None, 10]) # Labels
>>> stderr = std_error(y_pred, y_true)

>>> # Calculate standard error by feeding data X and labels Y
>>> std_error = sess.run(stderr_op, feed_dict={input_data: X, y_true: Y})
  • Args:

    • scope: scope to add the op to.
    • name: name of the op.
    • collect: add to metrics collection.
  • Returns: Float. The standard error.