NLR:利用非线性回归,梯度下降法求出学习参数θ,进而求得Cost函数最优值——Jason niu...
importnumpyasnpimportrandomdefgenData(numPoints,bias,variance):x=np.zeros(shape=(numPoints,2))y=np.zeros(shape=(numPoints))foriinrange(0,numPoints):x[i][0]=1x[i][1]=iy[i]=(i+bias)+random.uniform(0,1)%