Loss Functions#

custom_neural_net_creator.loss_functions#

custom_neural_net_creator.loss_functions.mean_squared_error(actual: ndarray[Any, dtype[_ScalarType_co]], prediction: ndarray[Any, dtype[_ScalarType_co]]) float#

Calculate the mean squared error between acuatl and predicted values.

This function computes the mean squared error (MSE) between the actual and predicted values. It takes two NumPy arrays, actual and prediction, and calculates the squared difference between corresponding elements, then returns the mean of those squared differences. Lower values indicate better performance during training.

Parameters:
  • actual (npt.NDArray) – The actual values.

  • prediction (npt.NDArray) – The predicted values.

Returns:

The mean squared error between actual and predicted values.

Return type:

float

custom_neural_net_creator.loss_functions.mean_squared_error_derivative(actual: ndarray[Any, dtype[_ScalarType_co]], prediction: ndarray[Any, dtype[_ScalarType_co]]) float#

Calculate the derivative of the mean squared error with respect to predicted values.

This function computes the mean squared error (MSE) between the actual and predicted values. It takes two NumPy arrays, actual and prediction, and calculates the squared difference between corresponding elements, then returns the mean of those squared differences. MSE is a common metric used to measure the accuracy of regression models. Lower values indicate better performance during training.

Parameters:
  • actual (npt.NDArray) – The actual values.

  • prediction (npt.NDArray) – The predicted values.

Returns:

The derivative of the mean squared error with respect to predicted values.

Return type:

float