Computes the MSEr threshold.

@return The MSEr threshold.
171104
protected double computeMseR() {
		double p_c;
		double mse_r = 0;

		for (int i = 0; i < this.classDistributions.length; i++) {
			p_c = (double) this.classDistributions[i] / (double) this.chunkSizeOption.getValue();
			mse_r += p_c * ((1 - p_c) * (1 - p_c));
		}

		return mse_r;
	}
815689
public double getMean() {
        if (getTotalCount() == 0) {
            return 0.0;
        }
        recordedValuesIterator.reset();
        double totalValue = 0;
        while (recordedValuesIterator.hasNext()) {
            HistogramIterationValue iterationValue = recordedValuesIterator.next();
            totalValue += medianEquivalentValue(iterationValue.getValueIteratedTo())
                    * iterationValue.getCountAtValueIteratedTo();
        }
        return (totalValue * 1.0) / getTotalCount();
    }
1194048
public double gMeasure(EvaluationAveraging averaging) {
        int nClasses = confusion().getClasses().size();
        if (averaging == EvaluationAveraging.Macro) {
            double macroGMeasure = 0.0;
            for (int i = 0; i < nClasses; i++) {
                macroGMeasure += gMeasure(i);
            }
            macroGMeasure /= nClasses;
            return macroGMeasure;
        } else if (averaging == EvaluationAveraging.Micro) {
            long tpCount = 0;
            long fpCount = 0;
            long fnCount = 0;
            for (int i = 0; i < nClasses; i++) {
                tpCount += truePositives.getCount(i);
                fpCount += falsePositives.getCount(i);
                fnCount += falseNegatives.getCount(i);
            }
            double precision = EvaluationUtils.precision(tpCount, fpCount, DEFAULT_EDGE_VALUE);
            double recall = EvaluationUtils.recall(tpCount, fnCount, DEFAULT_EDGE_VALUE);
            return EvaluationUtils.gMeasure(precision, recall);
        } else {
            throw new UnsupportedOperationException("Unknown averaging approach: " + averaging);
        }
    }
657107
def __threshold(self, ymx_i):
        
        return ymx_i - (self.S * np.diff(self.xsn).mean())
713824
public ThresholdStatus getWorstStatus(){

		if (configuration.getKillSwitch().disableMetricCollection())
			return ThresholdStatus.OFF;

		ThresholdStatus ret = ThresholdStatus.GREEN;
		for (Threshold t : getThresholds()){
			if (t.getStatus().overrules(ret))
				ret = t.getStatus();
		}
		return ret;
	}
1137470
public double getAnomalyScore(Instance inst)
	{
		if(this.referenceWindow)
			return 0.5;
		else
		{
			double accumulatedScore = 0.0;
			int massLimit = (int) (Math.ceil(this.sizeLimit*this.windowSize));
			double maxScore = this.windowSize * Math.pow(2.0, this.maxDepth);

			for(int i = 0 ; i < this.numTrees ; i++)
			{
				accumulatedScore += (forest[i].score(inst, massLimit) / maxScore);
			}

			accumulatedScore = accumulatedScore / (((double) this.numTrees));

			return 0.5 - accumulatedScore + this.anomalyThreshold;
		}
	}
1341814
double sparseProbabilisticAlgorithmCardinality() {
        final int m = this.m/*for performance*/;

        // compute the "indicator function" -- sum(2^(-M[j])) where M[j] is the
        // 'j'th register value
        double sum = 0;
        int numberOfZeroes = 0/*"V" in the paper*/;
        for(int j=0; j<m; j++) {
            final long register = sparseProbabilisticStorage.get(j);

            sum += 1.0 / (1L << register);
            if(register == 0L) numberOfZeroes++;
        }

        // apply the estimate and correction to the indicator function
        final double estimator = alphaMSquared / sum;
        if((numberOfZeroes != 0) && (estimator < smallEstimatorCutoff)) {
            return HLLUtil.smallEstimator(m, numberOfZeroes);
        } else if(estimator <= largeEstimatorCutoff) {
            return estimator;
        } else {
            return HLLUtil.largeEstimator(log2m, regwidth, estimator);
        }
    }
595943
protected void computeMseR() {
		double p_c;
		this.mse_r = 0;

		for (int i = 0; i < this.classDistributions.length; i++) {
			p_c = (double) this.classDistributions[i] / (double) this.windowSize;
			this.mse_r += p_c * ((1 - p_c) * (1 - p_c));
		}
	}
449192
public int computePriority(int basePriority) {
        boolean relaxedReporting = FindBugsAnalysisFeatures.isRelaxedMode();

        boolean atLeastMedium = false;
        boolean falsePositive = false;
        boolean atMostLow = false;
        boolean atMostMedium = false;
        boolean peggedHigh = false;
        int aLittleBitLower = 0;
        int priority = basePriority;
        if (!relaxedReporting) {
            for (T warningProperty : map.keySet()) {
                PriorityAdjustment adj = warningProperty.getPriorityAdjustment();
                if (adj == PriorityAdjustment.PEGGED_HIGH) {
                    peggedHigh = true;
                    priority--;
                } else if (adj == PriorityAdjustment.FALSE_POSITIVE) {
                    falsePositive = true;
                    atMostLow = true;
                } else if (adj == PriorityAdjustment.A_LITTLE_BIT_LOWER_PRIORITY) {
                    aLittleBitLower++;
                } else if (adj == PriorityAdjustment.A_LITTLE_BIT_HIGHER_PRIORITY) {
                    aLittleBitLower--;
                } else if (adj == PriorityAdjustment.RAISE_PRIORITY) {
                    --priority;
                } else if (adj == PriorityAdjustment.RAISE_PRIORITY_TO_AT_LEAST_NORMAL) {
                    --priority;
                    atLeastMedium = true;
                } else if (adj == PriorityAdjustment.LOWER_PRIORITY_TO_AT_MOST_NORMAL) {
                    ++priority;
                    atMostMedium = true;
                } else if (adj == PriorityAdjustment.RAISE_PRIORITY_TO_HIGH) {

                    return Priorities.HIGH_PRIORITY;
                } else if (adj == PriorityAdjustment.LOWER_PRIORITY) {
                    ++priority;
                } else if (adj == PriorityAdjustment.AT_MOST_LOW) {
                    priority++;
                    atMostLow = true;
                } else if (adj == PriorityAdjustment.AT_MOST_MEDIUM) {
                    atMostMedium = true;
                } else if (adj == PriorityAdjustment.NO_ADJUSTMENT) {
                    assert true; // do nothing
                } else {
                    throw new IllegalStateException("Unknown priority " + adj);
                }

            }

            if (peggedHigh && !falsePositive) {
                return Priorities.HIGH_PRIORITY;
            }
            if (aLittleBitLower >= 3 || priority == 1 && aLittleBitLower == 2) {
                priority++;
            } else if (aLittleBitLower <= -2) {
                priority--;
            }
            if (atMostMedium) {
                priority = Math.max(Priorities.NORMAL_PRIORITY, priority);
            }

            if (falsePositive && !atLeastMedium) {
                return Priorities.EXP_PRIORITY + 1;
            } else if (atMostLow) {
                return Math.min(Math.max(Priorities.LOW_PRIORITY, priority), Priorities.EXP_PRIORITY);
            }
            if (atLeastMedium && priority > Priorities.NORMAL_PRIORITY) {
                priority = Priorities.NORMAL_PRIORITY;
            }

            if (priority < Priorities.HIGH_PRIORITY) {
                priority = Priorities.HIGH_PRIORITY;
            } else if (priority > Priorities.EXP_PRIORITY) {
                priority = Priorities.EXP_PRIORITY;
            }
        }

        return priority;
    }
468142
public T max() {
        TObjectIntIterator<T> iter = counts.iterator();
        int maxCount = -1;
        T max = null;
        while (iter.hasNext()) {
            iter.advance();
            int count = iter.value();
            if (count > maxCount) {
                max = iter.key();
                maxCount = count;
            }
        }
        return max;
    }
1260183
private final int getDefaultIsolationLevel() {
        int defaultIsolationLevel = resRefInfo == null ? Connection.TRANSACTION_NONE : resRefInfo.getIsolationLevel();
        if (defaultIsolationLevel == Connection.TRANSACTION_NONE)
            defaultIsolationLevel = dsConfig.get().isolationLevel;
        if (defaultIsolationLevel == -1)
            defaultIsolationLevel = mcf.getHelper().getDefaultIsolationLevel();
        return defaultIsolationLevel;
    }
772808
public Level getSeverityLevel() {
        Level severity = Level.INFO;
        for (ValidationResultNotation note : notes) {
            Level noteLevel = note.getLevel();
            if (noteLevel.compareTo(severity) > 0) {
                severity = noteLevel;
            }
        }
        return severity;
    }
658961
protected boolean thresholdBinaryNumber() {

		int lower = (int) (N * (ambiguityThreshold / 2.0));
		int upper = (int) (N * (1 - ambiguityThreshold / 2.0));

		final int totalElements = getTotalGridElements();
		for (int i = 0; i < totalElements; i++) {
			if (counts[i] < lower) {
				classified[i] = 0;
			} else if (counts[i] > upper) {
				classified[i] = 1;
			} else {
				// it's ambiguous so just fail
				return true;
			}
		}
		return false;
	}
623726
def threshold(self):
        """"""
        if self._threshold is None:
            self._threshold = {
                'error': self.timer_warning,
                'warning': self.timer_ok,
            }[self.timer_fail]
        return self._threshold
63721
protected double kNNDistance() {
    double knnDist = 0.;
    for(int i = 0; i < getNumEntries(); i++) {
      MkMaxEntry entry = getEntry(i);
      knnDist = Math.max(knnDist, entry.getKnnDistance());
    }
    return knnDist;
  }
606618
public int getMin() {
        List<Integer> value = new ArrayList<Integer>();
        for (AnalysisType at : analysisType) {
            value.add(at.getValue());
        }
        return Collections.min(value);
    }
258884
public int getMaxToClaim(int nodeCount) {
       synchronized (cluster.allWorkUnits) {
           final int total = cluster.allWorkUnits.size();
           if (total <= 1) {
               return total;
           }
           return (int) Math.ceil(total / (double) nodeCount);
       }
   }