|
NNFS
Neural network library from scratch
|
Cross-entropy loss function. More...
#include <CCE.hpp>
Public Member Functions | |
| CCE () | |
| Construct a new CCE object. | |
| void | forward (Eigen::MatrixXd &sample_losses, const Eigen::MatrixXd &predictions, const Eigen::MatrixXd &labels) const |
| Forward pass of the CCE loss function. | |
| void | backward (Eigen::MatrixXd &out, const Eigen::MatrixXd &predictions, const Eigen::MatrixXd &labels) const |
| Backward pass of the CCE loss function. | |
Public Member Functions inherited from NNFS::Loss | |
| Loss (LossType type) | |
| Construct a new Loss object. | |
| virtual | ~Loss ()=default |
| Basic destructor. | |
| virtual void | forward (Eigen::MatrixXd &sample_losses, const Eigen::MatrixXd &predictions, const Eigen::MatrixXd &labels) const =0 |
| Forward pass of the loss function. | |
| virtual void | backward (Eigen::MatrixXd &out, const Eigen::MatrixXd &predictions, const Eigen::MatrixXd &labels) const =0 |
| Backward pass of the loss function. | |
| void | calculate (double &loss, const Eigen::MatrixXd &predictions, const Eigen::MatrixXd &labels) |
| Calculate the loss. | |
| double | regularization_loss (const std::shared_ptr< Dense > &layer) |
| Calculate l1 and l2 regularization loss. | |
Additional Inherited Members | |
Public Attributes inherited from NNFS::Loss | |
| LossType | type |
Cross-entropy loss function.
This class implements the cross-entropy loss function.
|
inline |
Construct a new CCE object.
|
inlinevirtual |
Backward pass of the CCE loss function.
| [out] | out | Output gradient |
| [in] | predictions | Predictions |
| [in] | labels | Labels |
Implements NNFS::Loss.
|
inlinevirtual |
Forward pass of the CCE loss function.
| [out] | sample_losses | Sample losses |
| [in] | predictions | Predictions |
| [in] | labels | Labels |
Implements NNFS::Loss.