LinearRegressionTest.py 文件源码

python
阅读 41 收藏 0 点赞 0 评论 0

项目:MachineLearningAlgorithm 作者: lining0806 项目源码 文件源码
def ridgeRegres(xMat, yMat, lam=0.2):
    xTx = xMat.T*xMat
    denom = xTx+np.eye(np.shape(xMat)[1])*lam
    if np.linalg.det(denom) == 0.0:
        print 'This matrix is singular, cannot do inverse'
        return
    ws = denom.I*(xMat.T*yMat)
    return ws
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号