Loss Functions¶
Loss functions measure how well a neural network’s predictions match the expected outputs. They guide the optimisation process by providing a scalar value to minimise during training.
The athena library provides several commonly used loss functions for different types of problems.
Available Loss Functions
Overview¶
Choosing the Right Loss Function¶
Loss Function Properties¶
All loss functions in athena:
Extend
base_loss_typeImplement a
computemethodWork with differentiable
array_typefor automatic gradient computationSupport batch processing
Usage Example¶
use athena__loss
use athena__network
! Create a network
type(network_type) :: net
type(mse_loss_type) :: loss
! Initialise loss function
loss = mse_loss_type()
! Use in training
call net%train(train_data, train_labels, loss=loss)
Creating custom loss functions¶
The athena library is designed with extensibility in mind, allowing users to create custom loss functions by extending the base_loss_type.
See the tutorial: Creating Custom Loss Functions