• Binary accuracy metric function.

    yTrue and yPred can have 0-1 values. Example:

    const x = tf.tensor2d([[1, 1, 1, 1], [0, 0, 0, 0]], [2, 4]);
    const y = tf.tensor2d([[1, 0, 1, 0], [0, 0, 0, 1]], [2, 4]);
    const accuracy = tf.metrics.binaryAccuracy(x, y);
    accuracy.print();

    yTrue and yPred can also have floating-number values between 0 and 1, in which case the values will be thresholded at 0.5 to yield 0-1 values (i.e., a value >= 0.5 and <= 1.0 is interpreted as 1).

    Example:

    const x = tf.tensor1d([1, 1, 1, 1, 0, 0, 0, 0]);
    const y = tf.tensor1d([0.2, 0.4, 0.6, 0.8, 0.2, 0.3, 0.4, 0.7]);
    const accuracy = tf.metrics.binaryAccuracy(x, y);
    accuracy.print();

    Parameters

    • yTrue: Tensor<Rank>

      Binary Tensor of truth.

    • yPred: Tensor<Rank>

      Binary Tensor of prediction.

    Returns Tensor

    Accuracy Tensor.

    Doc

Generated using TypeDoc