base.py 文件源码

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

项目:l1l2py 作者: slipguru 项目源码 文件源码
def _fit(self, X, y):
        # Calling the class-specific train method
        n, d = X.shape

        if n < d:
            tmp = np.dot(X, X.T)
            if self.mu != 0.0:
                tmp += self.mu * n * np.eye(n)
            tmp = la.pinv(tmp)

            coef_ = np.dot(np.dot(X.T, tmp), y)
        else:
            tmp = np.dot(X.T, X)
            if self.mu != 0.0:
                tmp += self.mu * n * np.eye(d)
            tmp = la.pinv(tmp)

            coef_ = np.dot(tmp, np.dot(X.T, y))
        self.coef_ = coef_
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号