15 using GHFunction = std::function< double(
double,
double) >;
struct arena_view arena_view_t
2d array abstraction
Definition Matrix.h:43
double MSE_gradient(double y, double y_pred)
Calculate the gradient value of the mean squared error.
double binary_crossentropy_gradient(double y, double y_pred)
Calculate the gradient of the log loss.
double binary_crossentropy_hessian(double y, double y_pred)
Calculate the hessian (second order derivative) of the log loss.
double RMSE_loss(const CNum::DataStructs::Matrix< double > &y, const CNum::DataStructs::Matrix< double > &y_pred)
Root mean squared error.
LossProfile get_loss_profile(::std::string loss)
Get the LossProfile associated with a string (i.e. "MSE" -> mean squared error function).
std::function< double(double, double) > GHFunction
Definition Loss.h:15
double get_loss(const CNum::DataStructs::Matrix< double > &y, const CNum::DataStructs::Matrix< double > &y_pred, LossFunction &loss_func)
Get the loss of a matrix of values.
void get_gradients_hessians(const CNum::DataStructs::Matrix< double > &y, const CNum::DataStructs::Matrix< double > &y_pred, arena_view_t &g_out, arena_view_t &h_out, const arena_view_t &position_array, GHFunction &grad_func, GHFunction &hess_func)
Get the Gradients and Hessians of a Matrix.
double MSE_hessian(double y, double y_pred)
Calculate the hessian (second order derivative) value of the mean squared error.
double binary_crossentropy_loss(const CNum::DataStructs::Matrix< double > &y, const CNum::DataStructs::Matrix< double > &y_pred)
Binary crossentropy (log loss).
std::function< double(const CNum::DataStructs::Matrix< double > &, const CNum::DataStructs::Matrix< double > &) > LossFunction
Definition Loss.h:16
double MSE_loss(const CNum::DataStructs::Matrix< double > &y, const CNum::DataStructs::Matrix< double > &y_pred)
Mean squared error.
The loss, gradient, and hessian functions associated with a loss function.
Definition Loss.h:22
GHFunction gradient_func
Definition Loss.h:24
LossFunction loss_func
Definition Loss.h:23
GHFunction hessian_func
Definition Loss.h:25