Calculates F1 score

        :return: F1 score
556149
def f1_score(self):
        
        m_pre = self.precision()
        rec = self.recall()
        return divide(2.0, 1.0 / m_pre + 1.0 / rec)
108059
def f1_curve(self, delta_tau=0.01):
        
        # compute thresholds based on the sorted probabilities
        orig_thresh = self.threshold
        sorted_labels, sorted_probs = self.sorted_values

        scores = []
        taus = []
        tau = 0
        for k in range(len(sorted_labels)):
            # compute new accuracy
            self.threshold = tau
            scores.append(self.f1_score)
            taus.append(tau)

            # update threshold
            tau = sorted_probs[k]

        # add last datapoint
        tau = 1.0
        self.threshold = tau
        scores.append(self.f1_score)
        taus.append(tau)

        self.threshold = orig_thresh
        return scores, taus
1177205
def compute_rewards(self, scores):
        
        k = self.k
        m = max(len(scores) - k, 0)
        best_scores = sorted(scores)[-k - 1:]
        velocities = np.diff(best_scores)
        nans = np.full(m, np.nan)
        return list(velocities) + list(nans)
1042640
def pwm_min_score(self):
        
        if self.min_score is None:
            score = 0
            for row in self.pwm:
                score += log(min(row) / 0.25 + 0.01)
            self.min_score = score
        
        return self.min_score
873871
def score(self, flags: Flags) -> int:
        

        score = 0

        for k, v in flags.items():
            if self.flags.get(k) == v:
                score += 1

        return score
612711
def obfn_f(self):
        
        """

        obf = 0.0
        for i in range(self.Nb):
            obf += self.obfn_fi(self.obfn_fvar(i), i)
        return obf
1130583
def ReliefF_compute_scores(inst, attr, nan_entries, num_attributes, mcmap, NN, headers, class_type, X, y, labels_std, data_type):
    
    scores = np.zeros(num_attributes)
    for feature_num in range(num_attributes):
        scores[feature_num] += compute_score(attr, mcmap, NN, feature_num, inst,
                                             nan_entries, headers, class_type, X, y, labels_std, data_type)
    return scores
993287
def get_scores(self, *args):
		'''
		
		'''
		if self.tdf_ is None:
			raise Exception("Use set_category_name('category name', ['not category name', ...]) " +
			                "to set the category of interest")

		avgdl = self.tdf_.sum(axis=0).mean()

		def idf(cat):
			# Number of categories with term
			n_q = (self.tdf_ > 0).astype(int).max(axis=1).sum()
			N = len(self.tdf_)
			return (N - n_q + 0.5) / (n_q + 0.5)

		def length_adjusted_tf(cat):
			tf = self.tdf_[cat]
			dl = self.tdf_[cat].sum()
			return ((tf * (self.k1 + 1))
			        / (tf + self.k1 * (1 - self.b + self.b * (dl / avgdl))))

		def bm25_score(cat):
			return - length_adjusted_tf(cat) * np.log(idf(cat))

		scores = bm25_score('cat') - bm25_score('ncat')
		return scores
1065723
def _compute_f4(self, C, mag, rrup):
        
        fhw_m = 0
        fhw_r = np.zeros_like(rrup)

        if mag <= 5.5:
            fhw_m = 0
        elif 5.5 < mag < 6.5:
            fhw_m = mag - 5.5
        else:
            fhw_m = 1

        idx = (rrup > 4) & (rrup <= 8)
        fhw_r[idx] = C['a9'] * (rrup[idx] - 4.) / 4.

        idx = (rrup > 8) & (rrup <=18)
        fhw_r[idx] = C['a9']

        idx = (rrup > 18) & (rrup <= 24)
        fhw_r[idx] = C['a9'] * (1 - (rrup[idx] - 18.) / 7.)

        return fhw_m * fhw_r
515373
def overall_f_measure(self):
        
        if self.overall['Nsys'] == 0 and self.empty_system_output_handling == 'zero_score':
            precision = 0

        else:
            precision = metric.precision(
                Ntp=self.overall['Ntp'],
                Nsys=self.overall['Nsys']
            )

        recall = metric.recall(
            Ntp=self.overall['Ntp'],
            Nref=self.overall['Nref']
        )

        f_measure = metric.f_measure(
            precision=precision,
            recall=recall
        )

        return {
            'f_measure': f_measure,
            'precision': precision,
            'recall': recall
        }
10617
function f1(d, m, r) {
    const t = m + d;
    const I = (t << r) | (t >>> (32 - r));
    return ((sBox[0][I >>> 24] ^ sBox[1][(I >>> 16) & 255]) - sBox[2][(I >>> 8) & 255]) + sBox[3][I & 255];
  }
264483
def output(self):
        ""
        FScore.output_header()
        nts = list(self.nt_score.keys())
        nts.sort()
        for nt in nts:
            self.nt_score[nt].output_row(nt)
        print()
        self.total_score.output_row("total")
1066542
def vline_score(self, x, ymin, ymax):
        
        return self._vline_score[x, ymin, ymax]
968915
def _calculate_split_score(self, split):
        
        left_error = gini(split['left'])
        right_error = gini(split['right'])
        error = gini(self.Y)
        # if the split is any good, the score should be greater than 0
        total = float(len(self.Y))
        score = error - 1 / total * (len(split['left']) * left_error\
                                     + len(split['right']) * right_error)
        return score
445772
def get_rms(self):
        
        return np.sqrt(np.mean(np.square(self._entry_scores)))
63233
def highest(self):
        
        scores = self.scores()
        if not scores:
            return None
        maxscore = max(map(score, scores))
        return filter(lambda x: score(x) == maxscore, scores)
231173
def gt(self, v, limit=None, offset=None):
        
        if limit is not None and offset is None:
            offset = 0
        return self.zrangebyscore("(%f" % v, self._max_score,
                start=offset, num=limit)