nnlib
GPU-accelerated, C/C++ neural network library.
|
Abstract class representing a loss function. More...
#include <loss.h>
Public Member Functions | |
Loss () | |
Constructor for the Loss class. More... | |
float | calculateMetric (const sTensor &targets, const sTensor &predictions) override |
Defines the method inherited from abstract Metric parent. More... | |
virtual sTensor | calculateLoss (const sTensor &targets, const sTensor &predictions)=0 |
![]() | |
Metric () | |
Constructor for the Metric class. More... | |
void | reset () |
Reset the metric, i.e.: set numSamples and currentTotalMetric to 0. | |
virtual std::string | getShortName () const =0 |
Short string identifier of the metric. More... | |
Additional Inherited Members | |
![]() | |
size_t | numSamples |
The number of samples processed so far. | |
float | currentTotalMetric |
The current total value of the metric. | |
Abstract class representing a loss function.
All loss functions are by default also metrics.
The child classes need to define the calculateLoss
and calculateDerivatives
methods.
Loss::Loss | ( | ) |
Constructor for the Loss class.
Initializes the numSamples
and currentTotalLoss
variables to 0.
|
overridevirtual |
Defines the method inherited from abstract Metric parent.
It simply calls the #calculateLoss function, which is implemented by every child loss function.
targets | The desired outputs of the network. |
predictions | The actual outputs of the network. |
Implements Metric.