CS229 吴恩达机器学习 习题答案 problem sets 02(全部问题,欢迎各位前辈指教)
01aimportnumpyasnpimportsrc.utilasutildefcalc_grad(X,Y,theta):"""Computethegradientofthelosswithrespecttotheta."""m,n=X.shapemargins=Y*X.dot(theta)probs=1./(1+np.exp(margins))grad=-(1./m)*(X.T.dot(pro