nnlib
GPU-accelerated, C/C++ neural network library.
|
The implementation of binary accuracy. More...
#include <metric.h>
Public Member Functions | |
BinaryAccuracy () | |
Constructor of BinaryAccuracy. | |
float | calculateMetric (const sTensor &targets, const sTensor &predictions) override |
Calcualate the current value of the metric given the new batches of targets and predictions. More... | |
std::string | getShortName () const override |
Short string identifier of the metric. More... | |
![]() | |
Metric () | |
Constructor for the Metric class. More... | |
void | reset () |
Reset the metric, i.e.: set numSamples and currentTotalMetric to 0. | |
Additional Inherited Members | |
![]() | |
size_t | numSamples |
The number of samples processed so far. | |
float | currentTotalMetric |
The current total value of the metric. | |
The implementation of binary accuracy.
This metric assumes the targets to be of shape Nx1 with N being the batch size. The targets can only consist of 0s and 1s corresponding to the two classes. The predictions can be any real value from the range [0, 1]. Predictions larger than 0.5 are assigned to class 1 while predictions smaller than 0.5 are assigned to class 0.
|
overridevirtual |
Calcualate the current value of the metric given the new batches of targets and predictions.
targets | The desired outputs of the network. |
predictions | The actual outputs of the network. |
Implements Metric.
|
overridevirtual |
Short string identifier of the metric.
Used when printing the value of the metric to the terminal.
Implements Metric.