Here's an implementation of the function mse_loss
:
main.m516 chars18 lines
t_hat
and actual values t
as inputs and returns the mean square error loss between them.diff
variable stores the difference between each corresponding value of t_hat
and t
.square_diff
variable calculates the square of the differences.out
variable calculates the mean of the square differences using the mean
function.gistlibby LogSnag