Takes entries from self._entries and returns a list of scores (or
        output scores, if based on grades)
972232
def _get_entry_scores(self):
        """"""
        if self.get_gradebook_column().get_grade_system().is_based_on_grades():
            return [e.get_grade().get_output_score() for e in self._entries if e.is_graded()]
        else:
            return [e.get_score() for e in self._entries if e.is_graded()]
538771
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'score' in _dict:
            args['score'] = _dict.get('score')
        if 'sentence' in _dict:
            args['sentence'] = _dict.get('sentence')
        if 'type' in _dict:
            args['type'] = _dict.get('type')
        if 'arguments' in _dict:
            args['arguments'] = [
                RelationArgument._from_dict(x) for x in (_dict.get('arguments'))
            ]
        return cls(**args)
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)
265807
def compute_rewards(self, scores):
        """"""
        if len(scores) > self.k:
            scores = np.copy(scores)
            inds = np.argsort(scores)[:-self.k]
            scores[inds] = np.nan

        return list(scores)
133690
def _compute_softmax(scores):
    """"""
    if not scores:
        return []

    max_score = None
    for score in scores:
        if max_score is None or score > max_score:
            max_score = score

    exp_scores = []
    total_sum = 0.0
    for score in scores:
        x = math.exp(score - max_score)
        exp_scores.append(x)
        total_sum += x

    probs = []
    for score in exp_scores:
        probs.append(score / total_sum)
    return probs
888812
def run(self, messages, env=None):
        
        if not self.args.score or self.args.testing:
            return

        format.print_line('~')
        print('Scoring tests')
        print()

        raw_scores = OrderedDict()
        for test in self.assignment.specified_tests:
            assert isinstance(test, sources_models.Test), 'ScoringProtocol received invalid test'

            log.info('Scoring test {}'.format(test.name))

            # A hack that allows programmatic API users to plumb a custom
            # environment through to Python tests.
            # Use type to ensure is an actual OkTest and not a subclass
            if type(test) == ok_test_models.OkTest:
                score = test.score(env=env)
            else:
                score = test.score()

            raw_scores[test.name] = (score, test.points)

        messages['scoring'] = display_breakdown(raw_scores, self.args.score_out)
        print()
165386
def fetch_entries(self):
        """"""
        data = []
        for row in self.get_rows():
            # Stop fetching data if limit has been met
            if exceeded_limit(self.limit, len(data)):
                break

            entry = row.find_all('td')
            entry_dict = {}

            show = entry[0].string
            net = entry[1].string
            if not self._match_query(show, net):
                continue

            entry_dict['show'] = show
            entry_dict['net'] = net
            entry_dict['time'] = entry[2].string

            if ',' in entry[3].string:
                entry_dict['viewers'] = entry[3].string.replace(',', '.')
            else:
                entry_dict['viewers'] = '0.' + entry[3].string
            entry_dict['rating'] = entry[4].string

            # Add data to create cable entry
            data.append(Entry(**entry_dict))

        return data
311015
def _get_keywords_with_score(extracted_lemmas, lemma_to_word):
    
    keywords = {}
    for score, lemma in extracted_lemmas:
        keyword_list = lemma_to_word[lemma]
        for keyword in keyword_list:
            keywords[keyword] = score
    return keywords
1180518
def parse_entry(self, entry):
        """"""
        entry = entry.split('\t')
        self.chrom, self.pos, self.id, self.ref, alt_, self.qual, filter_, info, self.format = entry[:9]
        self.samples = entry[9:]
        self.alt = alt_.split(',')
        if filter_ == 'PASS' or filter_ == '.':
            self.passed = True
        else:
            self.passed = filter_.split(';')
        self.info = info
        # currently unused
        #if info != '.':
            #info_l = info.split(';')
            #self.info = [v.split('=') if '=' in v else (v,1) for v in info_l]
        self.format = self.format.split(':')
        if 'GT' in self.format:
            self.GT = self.format.index('GT')
        if 'GQ' in self.format:
            self.GQ = self.format.index('GQ')
        if 'DP' in self.format:
            self.DP = self.format.index('DP')
        if 'FT' in self.format:
            self.FT = self.format.index('FT')
117281
def compute_rewards(self, scores):
        """"""
        for i in range(len(scores)):
            if i >= self.k:
                scores[i] = 0.
        return scores
462006
function filterResults(results, maximum) {
  var filteredResults = []
  var indices = []
  var matrix = {}
  var column
  var key
  var score
  var interpolated
  var index
  var otherIndex
  var maxScore

  for (key in results) {
    score = results[key].score

    if (!matrix[score]) {
      matrix[score] = []
      indices.push(score)
    }

    matrix[score].push(results[key])
  }

  indices.sort(reverse)

  maxScore = indices[0]

  index = -1

  while (indices[++index]) {
    score = indices[index]
    column = matrix[score]

    interpolated = score / maxScore
    otherIndex = -1

    while (column[++otherIndex]) {
      column[otherIndex].score = interpolated
    }

    filteredResults = filteredResults.concat(column)

    if (filteredResults.length >= maximum) {
      break
    }
  }

  return filteredResults
}
88648
def fetch_entries(self):
        """"""
        current_time = ''

        data = []
        for row in self.get_rows():
            # Stop fetching data if limit has been met
            if exceeded_limit(self.limit, len(data)):
                break

            entry = row.find_all('td')
            entry_dict = {}

            show_time = entry[0].string
            if show_time and show_time != current_time:
                current_time = show_time
            if not show_time:
                show_time = current_time
            entry_dict['time'] = show_time

            show_string = entry[1].string.split('(')
            show = show_string[0][:-1]
            net = self._get_net(show_string)
            if not self._match_query(show, net):
                continue

            entry_dict['show'] = show
            entry_dict['net'] = net
            entry_dict['viewers'] = entry[3].string.strip('*')
            entry_dict['rating'], entry_dict['share'] = self._get_rating(entry)

            # Add data to initialize broadcast entry
            data.append(Entry(**entry_dict))

        return data
495448
def entries(self, start = None, end = None):
        ''''''
        if not start:
            start = self.earliest_record
        if not end:
            end = self.latest_record
        fr = start.strftime('%Y%m%d')
        to = end.strftime('%Y%m%d')
        url = str.format(
            'projects/{}/entries?from={}&to={}',
            self.id,
            fr,
            to,
        )
        response = self.hv.get_request(url)
        return [Entry(self.hv, ej['day_entry']) for ej in response]
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
184912
def results(self):
        

        results = {
            'overall': self.results_overall_metrics(),
            'class_wise': self.results_class_wise_metrics(),
            'class_wise_average': self.results_class_wise_average_metrics()
        }

        return results
736409
def _parse_entry(self, cols):
        
        rank, name, vocation, *values = [c.text.replace('\xa0', ' ').strip() for c in cols]
        rank = int(rank)
        if self.category == Category.EXPERIENCE or self.category == Category.LOYALTY_POINTS:
            extra, value = values
        else:
            value, *extra = values
        value = int(value.replace(',', ''))
        if self.category == Category.EXPERIENCE:
            entry = ExpHighscoresEntry(name, rank, vocation, value, int(extra))
        elif self.category == Category.LOYALTY_POINTS:
            entry = LoyaltyHighscoresEntry(name, rank, vocation, value, extra)
        else:
            entry = HighscoresEntry(name, rank, vocation, value)
        self.entries.append(entry)
733135
def filter_ranks(results):
    
    for _, group in itertools.groupby(results, operator.itemgetter(0)):
        yield next(group)