pub fn gradient_mse(
x: &Vec<Vec<f64>>,
y_hat: &Vec<f64>,
y: &Vec<f64>,
) -> Result<Vec<f64>, Error>
Expand description
Calculates the gradient of the mean squared error between two vectors.
§Formula
dMSE/dw = 2/n * sum((y_hat - y) * x)
§Arguments
x
- Vector of input valuesy_hat
- Vector of predicted valuesy
- Vector of actual values
§Returns
- Vector of partial derivatives of MSE with respect to each weight
- The last element of the vector is the partial derivative with respect to the intercept