Calculate the Brier Skill Score
429815
def brier_skill_score(self):
        
        reliability, resolution, uncertainty = self.brier_score_components()
        return (resolution - reliability) / uncertainty
515436
def scores(self, result, add_new_line=True):
        """"""
        if result.goalsHomeTeam > result.goalsAwayTeam:
            homeColor, awayColor = (self.colors.WIN, self.colors.LOSE)
        elif result.goalsHomeTeam < result.goalsAwayTeam:
            homeColor, awayColor = (self.colors.LOSE, self.colors.WIN)
        else:
            homeColor = awayColor = self.colors.TIE

        click.secho('%-25s %2s' % (result.homeTeam, result.goalsHomeTeam),
                    fg=homeColor, nl=False)
        click.secho("  vs ", nl=False)
        click.secho('%2s %s' % (result.goalsAwayTeam,
                                result.awayTeam.rjust(25)), fg=awayColor,
                    nl=add_new_line)
1262309
def H10(self):
        ""
        c = (self.rlevels * self.p_xminusy).sum(1)
        c1 = np.tile(c, (self.nlevels,1)).transpose()
        e = self.rlevels - c1
        return (self.p_xminusy * e ** 2).sum(1)
105333
def fscore(beta)
      b2 = Float(beta**2)
      ((b2 + 1) * precision * recall) / (b2 * precision + recall)
    end
561741
def rank(self, member):
        
        score = self._members.get(member)
        if score is None:
            return None
        return bisect_left(self._scores, (score, member))
917224
function (score) {
                var w = score * itemdata('starwidth') * itemdata('step');
                var h = range.find('.rateit-hover');
                if (h.data('width') != w) {
                    range.find('.rateit-selected').hide();
                    h.width(w).show().data('width', w);
                    var data = [(score * itemdata('step')) + itemdata('min')];
                    item.trigger('hover', data).trigger('over', data);
                }
            }
1302717
def peirce_skill_score(self):
        
        n = float(self.table.sum())
        nf = self.table.sum(axis=1)
        no = self.table.sum(axis=0)
        correct = float(self.table.trace())
        return (correct / n - (nf * no).sum() / n ** 2) / (1 - (no * no).sum() / n ** 2)
1055174
def evaluate_tour_P(self, tour):
        
        from .chic import score_evaluate_P
        return score_evaluate_P(tour, self.active_sizes, self.P)
117281
def compute_rewards(self, scores):
        """"""
        for i in range(len(scores)):
            if i >= self.k:
                scores[i] = 0.
        return scores
656630
def get_score(self, member, default=None, pipe=None):
        
        pipe = self.redis if pipe is None else pipe
        score = pipe.zscore(self.key, self._pickle(member))

        if (score is None) and (default is not None):
            score = float(default)

        return score
1341708
def evaluate_tour_Q(self, tour):
        
        from .chic import score_evaluate_Q
        return score_evaluate_Q(tour, self.active_sizes, self.Q)
104479
def rank(self, score):
        ''''''
        node = self.__head
        rank = 0
        for i in range(self.__level-1, -1, -1):
            while node.next[i] and node.next[i].score <= score:
                rank += node.width[i]
                node = node.next[i]
        if node.score == score:
            return rank - 1
        else:
            return -1 - rank
1255497
def toDict(self):
        
        result = _Base.toDict(self)
        result['score'] = self.score.score
        return result
980312
function TFIDF (ops) {
  const calculateScore = (x, i, resultset) => {
    const idf = Math.log((global.D + 1) / resultset.length);
    x.score = +x.match.reduce(
      (acc, cur) => acc + idf * +cur.split(':')[1], 0
    ).toFixed(2); // TODO: make precision an option
    return x
  };
  return ops
    .resultSet
    .map(calculateScore)
  // sort by score descending
    .sort((a, b) => b.score - a.score)
  // limit to n hits
    .slice(ops.offset, ops.limit)
}
199984
def find_skill(self, param, author=None, skills=None):
        # type: (str, str, List[SkillEntry]) -> SkillEntry
        """"""
        if param.startswith('https://') or param.startswith('http://'):
            repo_id = SkillEntry.extract_repo_id(param)
            for skill in self.list():
                if skill.id == repo_id:
                    return skill
            name = SkillEntry.extract_repo_name(param)
            path = SkillEntry.create_path(self.skills_dir, param)
            return SkillEntry(name, path, param, msm=self)
        else:
            skill_confs = {
                skill: skill.match(param, author)
                for skill in skills or self.list()
            }
            best_skill, score = max(skill_confs.items(), key=lambda x: x[1])
            LOG.info('Best match ({}): {} by {}'.format(
                round(score, 2), best_skill.name, best_skill.author)
            )
            if score < 0.3:
                raise SkillNotFound(param)
            low_bound = (score * 0.7) if score != 1.0 else 1.0

            close_skills = [
                skill for skill, conf in skill_confs.items()
                if conf >= low_bound and skill != best_skill
            ]
            if close_skills:
                raise MultipleSkillMatches([best_skill] + close_skills)
            return best_skill
556149
def f1_score(self):
        
        m_pre = self.precision()
        rec = self.recall()
        return divide(2.0, 1.0 / m_pre + 1.0 / rec)
600915
function brcomp(a, b, x, y) {
      var lambda;

      lambda = a - (a + b) * x;
      if (Math.min(a, b) < 8) {
         return a * Math.log(x) + b * Math.log(y) - lbeta(a, b);
      }
      return 0.5 * (Math.log(a) + Math.log(b) - C.log2pi - Math.log(a + b)) -
             a * phi(1 - lambda / a) - b * phi(1 + lambda / b) -
             bcorr(a, b);
   }