mu = sum(X)/m;
I thought something was wrong in these equations as the region with the highest probability did not show as the pdf tour with a red oval.
After debugging for a while, I found the center of Gaussian distribution contours color is yellow, which is nearly invisible on a none Retina screen. 😂😂😂
p = (pval < epsilon);
tmp = X*Theta' .* R - Y;
X_grad = tmp*Theta;
J = J + lambda/2*(sum(sum(Theta.^2))) + lambda/2*(sum(sum(X.^2)));
X_grad = X_grad + lambda*X;