def __init__(self, priors, sigma=10, scale_type='none', prior_power=1): ''' Parameters ---------- priors : pd.Series term -> prior count sigma : np.float prior scale scale_type : str 'none': Don't scale prior. Jurafsky approach. 'class-size': Scale prior st the sum of the priors is the same as the word count in the document-class being scaled 'corpus-size': Scale prior to the size of the corpus 'word': Original formulation from MCQ. Sum of priors will be sigma. 'background-corpus-size': Scale corpus size to multiple of background-corpus. prior_power : numeric Exponent to apply to prior > 1 will shrink frequent words ''' assert scale_type in [ 'none', 'class-size', 'corpus-size', 'background-corpus-size', 'word' ] self._priors = priors self._scale_type = scale_type self._prior_power = prior_power self._scale = sigma LogOddsRatioUninformativeDirichletPrior.__init__(self, sigma)
def __init__(self, priors, sigma=10, scale_type='none', prior_power=1): ''' Parameters ---------- priors : pd.Series term -> prior count sigma : np.float prior scale scale_type : str 'none': Don't scale prior. Jurafsky approach. 'class-size': Scale prior st the sum of the priors is the same as the word count in the document-class being scaled 'corpus-size': Scale prior to the size of the corpus 'word': Original formulation from MCQ. Sum of priors will be sigma. 'background-corpus-size': Scale corpus size to multiple of background-corpus. prior_power : numeric Exponent to apply to prior > 1 will shrink frequent words ''' assert scale_type in ['none', 'class-size', 'corpus-size', 'background-corpus-size', 'word'] self._priors = priors self._scale_type = scale_type self._prior_power = prior_power self._scale = sigma LogOddsRatioUninformativeDirichletPrior.__init__(self, sigma)
def __init__(self, priors, alpha_w=10): ''' Parameters ---------- alpha_w : np.float The constant prior. ''' self._priors = priors LogOddsRatioUninformativeDirichletPrior.__init__(self, alpha_w)