Gets the mode of the score.

        If this system is based on grades, the mode of the output score
        is returned.

        return: (decimal) - the median score
        *compliance: mandatory -- This method must be implemented.*
322736
def get_mode(self):
        
        # http://stackoverflow.com/questions/10797819/finding-the-mode-of-a-list-in-python
        return max(set(self._entry_scores), key=self._entry_scores.count)
760437
def value(self):
        

        if self.scores.numel() == 0:
            return 0
        ap = torch.zeros(self.scores.size(1))
        if hasattr(torch, "arange"):
            rg = torch.arange(1, self.scores.size(0) + 1).float()
        else:
            rg = torch.range(1, self.scores.size(0)).float()
        if self.weights.numel() > 0:
            weight = self.weights.new(self.weights.size())
            weighted_truth = self.weights.new(self.weights.size())

        # compute average precision for each class
        for k in range(self.scores.size(1)):
            # sort scores
            scores = self.scores[:, k]
            targets = self.targets[:, k]
            _, sortind = torch.sort(scores, 0, True)
            truth = targets[sortind]
            if self.weights.numel() > 0:
                weight = self.weights[sortind]
                weighted_truth = truth.float() * weight
                rg = weight.cumsum(0)

            # compute true positive sums
            if self.weights.numel() > 0:
                tp = weighted_truth.cumsum(0)
            else:
                tp = truth.float().cumsum(0)

            # compute precision curve
            precision = tp.div(rg)

            # compute average precision
            ap[k] = precision[truth.byte()].sum() / max(float(truth.sum()), 1)
        return ap
1172983
def modes(self):
        
        (self._modes, value) = self.get_cached_attr_set(self._modes, 'modes')
        return value
77527
public double getMedianValue() {
        Lock lock = this.getLock().writeLock();
        try {
            lock.lock();
            int count = this.values.size();
            if (count == 0) {
                return 0.0d;
            }
            if (this.medianValue == null) {
                // Sort the values in numerical order..
                Comparator<T> comparator = this.math.getComparator();
                Collections.sort(this.values, comparator);
                this.medianValue = 0.0d;
                // If there is only one value, then the median is that value ...
                if (count == 1) {
                    this.medianValue = this.values.get(0).doubleValue();
                }
                // If there is an odd number of values, find value that is in the middle ..
                else if (count % 2 != 0) {
                    this.medianValue = this.values.get(((count + 1) / 2) - 1).doubleValue();
                }
                // Otherwise, there is an even number of values, so find the average of the middle two values ...
                else {
                    int upperMiddleValueIndex = count / 2;
                    int lowerMiddleValueIndex = upperMiddleValueIndex - 1;
                    double lowerValue = this.values.get(lowerMiddleValueIndex).doubleValue();
                    double upperValue = this.values.get(upperMiddleValueIndex).doubleValue();
                    this.medianValue = (lowerValue + upperValue) / 2.0d;
                }
                this.median = this.math.create(this.medianValue);
                this.histogram = null;
            }
        } finally {
            lock.unlock();
        }
        return this.medianValue;
    }
411654
def score(self, report):
        """"""
        score = 0

        try:
            # cuckoo-modified format
            score = report['malscore']
        except KeyError:
            # cuckoo-2.0 format
            score = report.get('info', {}).get('score', 0)

        return score
568601
def get_or_set_score(self, member, default=0):
        
        default = float(default)

        def get_or_set_score_trans(pipe):
            pickled_member = self._pickle(member)
            score = pipe.zscore(self.key, pickled_member)

            if score is None:
                pipe.zadd(self.key, {self._pickle(member): default})
                return default

            return score

        return self._transaction(get_or_set_score_trans)
1310521
function mode() {
      var value = (attr.mdMode || "").trim();
      if (value) {
        switch (value) {
          case MODE_DETERMINATE:
          case MODE_INDETERMINATE:
          case MODE_BUFFER:
          case MODE_QUERY:
            break;
          default:
            value = MODE_INDETERMINATE;
            break;
        }
      }
      return value;
    }
900403
public function getRatio()
    {
        $total = $this->score->getValid() +
            $this->score->getPartial() +
            $this->score->getNotValid();

        return $this->score->getValid() == 0 ? 0 : (float) number_format($this->score->getValid()/$total, 2);
    }
224141
def mean(self) -> Optional[float]:
        
        if self._stats:    # TODO: should be true always?
            if self.total > 0:
                return self._stats["sum"] / self.total
            else:
                return np.nan
        else:
            return None
1278296
def mode(name, num, minimum=0, maximum=0, ref=None):
    '''
    
    '''
    return calc(
        name=name,
        num=num,
        oper='mode',
        minimum=minimum,
        maximum=maximum,
        ref=ref
    )
23366
def get_mode(self, old_mode=None):
        
        if self.mode is not None:
            return self.mode
        assert self.can_write, "This format does not have a supported output mode."
        if old_mode is None:
            return self.output_modes[0]
        if old_mode in self.output_modes:
            return old_mode
        # now let's get best mode available from supported
        try:
            idx = PILLOW_MODES.index(old_mode)
        except ValueError:
            # maybe some unknown or uncommon mode
            return self.output_modes[0]
        for mode in PILLOW_MODES[idx+1:]:
            if mode in self.output_modes:
                return mode
        # since there is no better one, lets' look for closest one in opposite direction
        opposite = PILLOW_MODES[:idx]
        opposite.reverse()
        for mode in opposite:
            if mode in self.output_modes:
                return mode
997261
def get_temporal_score_df(self):
		'''
		

		'''
		scoredf = {}
		tdf = self.term_ranker(self.corpus).get_ranks()
		for cat in sorted(self.corpus.get_categories()):
			if cat >= self.starting_time_step:
				negative_categories = self._get_negative_categories(cat, tdf)
				scores = self.term_scorer.get_scores(
					tdf[cat + ' freq'].astype(int),
					tdf[negative_categories].sum(axis=1)
				)
				scoredf[cat + ' score'] = scores
				scoredf[cat + ' freq'] = tdf[cat + ' freq'].astype(int)
		return pd.DataFrame(scoredf)
1083611
def get_control_mode(self):
        
        mode_value = self.read_register(4101)
        
        try:
            return CONTROL_MODES[mode_value]
        except KeyError:
            raise ValueError( 'Could not parse the control mode value: {0}. Allowed values are: {1}'.format(
                repr(mode_value), repr(list(CONTROL_MODES.keys()) ) ))
1346946
def mode(self, axis=0, numeric_only=False, dropna=True):
        
        axis = self._get_axis_number(axis)
        return self.__constructor__(
            query_compiler=self._query_compiler.mode(
                axis=axis, numeric_only=numeric_only, dropna=dropna
            )
        )
858471
def get_grade_metadata(self):
        
        # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template
        metadata = dict(self._mdata['grade'])
        metadata.update({'existing_id_values': self._my_map['gradeId']})
        return Metadata(**metadata)
665037
def clear_output_score(self):
        
        # Implemented from template for osid.grading.GradeSystemForm.clear_lowest_numeric_score
        if (self.get_output_score_metadata().is_read_only() or
                self.get_output_score_metadata().is_required()):
            raise errors.NoAccess()
        self._my_map['outputScore'] = self._output_score_default
48163
def score(self, full_report=False):
        
        if len(self) <= 2:
            return 0.0

        n = len(self)
        m = self.top_node.count_nodes()

        def s_center_score():
            """
            Returns a normalized score, indicating roughly how many times
            intervals share s_center with other intervals. Output is full-scale
            from 0 to 1.
            :rtype: float
            """
            raw = n - m
            maximum = n - 1
            return raw / float(maximum)

        report = {
            "depth": self.top_node.depth_score(n, m),
            "s_center": s_center_score(),
        }
        cumulative = max(report.values())
        report["_cumulative"] = cumulative
        if full_report:
            return report
        return cumulative