da.py 文件源码

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

项目:cebl 作者: idfah 项目源码 文件源码
def __init__(self, classData, average=0.0, shrinkage=0.0):
        """Construct a new Quadratic Discriminant Analysis (QDA) classifier.

        Args:
            classData:  Training data.  This is a numpy array or list of numpy
                        arrays with shape (nCls,nObs[,nIn]).  If the dimensions
                        index is missing the data is assumed to be
                        one-dimensional.

            average:    This parameter regularizes QDA by mixing the class
                        covariance matrices with the average covariance matrix.
                        A value of zero is pure QDA while a value of one
                        reduces to LDA.

            shrinkage:  This parameter regularizes QDA by shrinking each
                        covariance matrix toward the average eigenvalue of
                        the average covariance matrix.

        Returns:
            A trained QDA classifier.
        """
        Classifier.__init__(self, util.colmat(classData[0]).shape[1],
                            len(classData))

        self.dtype = np.result_type(*[cls.dtype for cls in classData])

        # average regularization parameter
        self.average = average

        # shrinkage regularization parameter
        self.shrinkage = shrinkage

        self.train(classData)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号