nnlib
GPU-accelerated, C/C++ neural network library.
Functions
binary_accuracy.cpp File Reference

Source file defining the methods of the BinaryAccuracy class. More...

#include "exceptions/unsupported_operation_exception.h"
#include <metric.h>

Functions

bool isCorrectPrediction (const float expected, const float actual)
 Returns true if the sample is correctly classified. More...
 

Detailed Description

Source file defining the methods of the BinaryAccuracy class.

Author
Jan Warchocki
Date
07 May 2023

Function Documentation

◆ isCorrectPrediction()

bool isCorrectPrediction ( const float  expected,
const float  actual 
)

Returns true if the sample is correctly classified.

Values of actual < 0.5 are assigned to class 0 while actual >= 0.5 are assigned to class 1.

Parameters
expectedThe expected class.
actualThe prediction (any real value from [0, 1])
Returns
True if the prediction corresponds to the correct class, false otherwise.