copula.py 文件源码

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

项目:mixedvines 作者: asnelt 项目源码 文件源码
def estimate_theta(self, samples):
        '''
        Estimates the theta parameters from the given samples.

        Parameters
        ----------
        samples : array_like
            n-by-2 matrix of samples where n is the number of samples.
        '''
        if self.theta is not None:
            bnds = self.theta_bounds()

            def cost(theta):
                '''
                Calculates the cost of a given `theta` parameter.
                '''
                self.theta = np.asarray(theta)
                vals = self.logpdf(samples)
                # For optimization, filter out inifinity values
                return -np.sum(vals[np.isfinite(vals)])

            result = minimize(cost, self.theta, method='TNC', bounds=bnds)
            self.theta = result.x
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号