ScaledFScoreSignificance.py 文件源码

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

项目:scattertext 作者: JasonKessler 项目源码 文件源码
def get_p_vals(self, X):
        '''
        Imputes p-values from the Z-scores of `ScaledFScore` scores.  Assuming incorrectly
        that the scaled f-scores are normally distributed.

        Parameters
        ----------
        X : np.array
            Array of word counts, shape (N, 2) where N is the vocab size.  X[:,0] is the
            positive class, while X[:,1] is the negative class.

        Returns
        -------
        np.array of p-values

        '''
        f_scores = ScaledFScore.get_scores(X[:,0], X[:,1], self.scaler_algo, self.beta)
        z_scores = (f_scores - np.mean(f_scores))/(np.std(f_scores)/np.sqrt(len(f_scores)))
        return norm.cdf(z_scores)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号