Mean Squared Error Derivative
Functions
mean_squared_error_derivative(Y, Y_hat)
Calculate the derivative of the mean squared error loss.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Y |
ndarray
|
True values. |
required |
Y_hat |
ndarray
|
Predicted values. |
required |
Returns:
| Type | Description |
|---|---|
|
numpy.ndarray: The gradient of the mean squared error. |
Example
Note
The result is divided by the number of samples (Y.shape[1]) to get the average gradient across all samples.