def get_scores_for_category(self):
     cat_counts, not_cat_counts = self._get_counts()
     scores = ScaledFScore.get_scores_for_category(cat_counts, not_cat_counts)
     np.testing.assert_almost_equal(scores,
                                    [0.23991183969723384, 0.24969810634506373, 0.23991183969723384,
                                     0.27646711056272855, 0.92885244834997516, 0.42010144843632563,
                                     0.49166017105966719, 0.0, 0.0, 0.50262304057984664])
Esempio n. 2
0
 def get_scores_for_category(self):
     cat_counts, not_cat_counts = self._get_counts()
     scores = ScaledFScore.get_scores_for_category(cat_counts,
                                                   not_cat_counts)
     np.testing.assert_almost_equal(scores, [
         0.23991183969723384, 0.24969810634506373, 0.23991183969723384,
         0.27646711056272855, 0.92885244834997516, 0.42010144843632563,
         0.49166017105966719, 0.0, 0.0, 0.50262304057984664
     ])
Esempio n. 3
0
    def get_scaled_f_scores_vs_background(self, scaler_algo='none', beta=1.):
        '''
		Parameters
		----------
		scaler_algo : str
			see get_scaled_f_scores, default 'none'
		beta : float
		  default 1.
		Returns
		-------
		pd.DataFrame of scaled_f_score scores compared to background corpus
		'''
        df = self.get_term_and_background_counts()
        df['Scaled f-score'] = ScaledFScore.get_scores_for_category(
            df['corpus'], df['background'], scaler_algo, beta)
        return df.sort_values(by='Scaled f-score', ascending=False)