libdl
0.0.1
Simple yet powerful deep learning
|
Contains some general purpose loss objectives. More...
#include "../tensor/math.hpp"
Go to the source code of this file.
Functions | |
TensorPtr | dl::loss::mse (TensorPtr x, TensorPtr y) noexcept |
Mean Square Error. | |
TensorPtr | dl::loss::bce (TensorPtr x, TensorPtr y) noexcept |
Binary Cross Entropy Loss. | |
Contains some general purpose loss objectives.
Definition in file loss.hpp.
Binary Cross Entropy Loss.
Implements the binary cross entropy loss function. Let \(\vec{x}=\begin{pmatrix}x_1 & \dots & x_n\end{pmatrix}\) be the model's outputs and \(\vec{y}=\begin{pmatrix}y_1 & \dots & y_n\end{pmatrix}\) the targets, the binary cross entropy loss is defined as
\[\text{BCE}(\vec{x}, \vec{y}) := -\frac{1}{n}\sum_{i=1}^n (y_i\log x_i + (1-y_i)\log(1-x_i)).\]
x | the model outputs |
y | the targets (desired outputs) |
Mean Square Error.
Implements the mean square error loss function. Let \(\vec{x}=\begin{pmatrix}x_1 & \dots & x_n\end{pmatrix}\) be the model's outputs and \(\vec{y}=\begin{pmatrix}y_1 & \dots & y_n\end{pmatrix}\) the targets, the margin square error is defined as
\[\text{MSE}(\vec{x}, \vec{y}) := \frac{1}{n}\sum_{i=1}^n (x_i - y_i)^2.\]
x | the model outputs |
y | the targets (desired outputs) |