13.2. Mean Absolute Error (MAE)
- class fhez.nn.loss.mae.MAE
Loss function to node wrapper.
- backward(gradient)
Calculate MAE gradient with respect to \(\hat{y}\).
This will take a single gradient value, and return the average gradient with respect to \(\hat{y}\)
\(\dfrac{d}{d\hat{y}}(\text{MAE}) = \begin{cases} +1,\quad \hat{y}>y\\ \ \ \ 0,\quad \hat{y}=y\\-1,\quad \hat{y}<y \end{cases}\)
- cost()
Get computational cost of the forward function.
- forward(y: numpy.ndarray, y_hat: numpy.ndarray)
Calculate the loss of the output given the ground truth.
This will take multiple values for both \(y\) and \(\hat{y}\), and return a single value that is the mean of their absolute difference.
\(\text{MAE}=\frac{\sum_{i=0}^{N-1} \left\|y-\hat{y}\right\| }{N}\)
- update()
Do nothing as there are no parameters to update.
- updates()
Do nothing as there are no parameters to update.