copula.py 文件源码

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

项目:mixedvines 作者: asnelt 项目源码 文件源码
def logcdf(self, samples):
        '''
        Calculates the log of the cumulative distribution function.

        Parameters
        ----------
        samples : array_like
            n-by-2 matrix of samples where n is the number of samples.

        Returns
        -------
        vals : ndarray
            Log of the cumulative distribution function evaluated at `samples`.
        '''
        samples = np.copy(np.asarray(samples))
        samples = self.__crop_input(samples)
        samples = self.__rotate_input(samples)
        vals = self._logcdf(samples)
        # Transform according to rotation, but take `__rotate_input` into
        # account.
        if self.rotation == '90°':
            old_settings = np.seterr(divide='ignore')
            vals = np.log(np.maximum(0, samples[:, 0] - np.exp(vals)))
            np.seterr(**old_settings)
        elif self.rotation == '180°':
            old_settings = np.seterr(divide='ignore')
            vals = np.log(np.maximum(0,
                                     (1 - samples[:, 0]) + (1 - samples[:, 1])
                                     - 1.0 + np.exp(vals)))
            np.seterr(**old_settings)
        elif self.rotation == '270°':
            old_settings = np.seterr(divide='ignore')
            vals = np.log(np.maximum(0, samples[:, 1] - np.exp(vals)))
            np.seterr(**old_settings)
        return vals
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号