this method obtains the minimum, maximum, and average quality values from the quality scores array
486096
private void obtainQualityMarks() {
        int total = 0;
        for (int i = 0; i < this.qualityScoresArray.length; i++) {
            total += this.qualityScoresArray[i];
            this.maximumQuality = Math.max(this.qualityScoresArray[i], this.maximumQuality);
            this.minimumQuality = Math.min(this.qualityScoresArray[i], this.minimumQuality);
        }
        this.averageQuality = (double) total / this.quality.length();
    }
783417
private int[] selectBestPair( SceneStructureMetric structure ) {
		Se3_F64 w_to_0 = structure.views[0].worldToView;
		Se3_F64 w_to_1 = structure.views[1].worldToView;
		Se3_F64 w_to_2 = structure.views[2].worldToView;

		Se3_F64 view0_to_1 = w_to_0.invert(null).concat(w_to_1,null);
		Se3_F64 view0_to_2 = w_to_0.invert(null).concat(w_to_2,null);
		Se3_F64 view1_to_2 = w_to_1.invert(null).concat(w_to_2,null);

		Se3_F64 candidates[] = new Se3_F64[]{view0_to_1,view0_to_2,view1_to_2};

		int best = -1;
		double bestScore = Double.MAX_VALUE;
		for (int i = 0; i < candidates.length; i++) {
			double s = score(candidates[i]);
			System.out.println("stereo score["+i+"] = "+s);
			if( s < bestScore ) {
				bestScore = s;
				best = i;
			}
		}

		switch (best) {
			case 0: return new int[]{0,1};
			case 1: return new int[]{0,2};
			case 2: return new int[]{1,2};
		}
		throw new RuntimeException("BUG!");
	}
533001
@Override
	public int[][][] getScoreMatrix() {
		boolean tempStoringScoreMatrix = storingScoreMatrix;
		if (scores == null) {
			storingScoreMatrix = true;
			align();
			if (scores == null) {
				return null;
			}
		}
		int[][][] copy = scores;
		if (tempStoringScoreMatrix) {
			copy = new int[scores.length][scores[0].length][];
			for (int i = 0; i < copy.length; i++) {
				for (int j = 0; j < copy[0].length; j++) {
					copy[i][j] = Arrays.copyOf(scores[i][j], scores[i][j].length);
				}
			}
		}
		setStoringScoreMatrix(tempStoringScoreMatrix);
		return copy;
	}
68522
public float[][] getTheta() {
        float[][] theta = new float[documents.length][K];

        if (SAMPLE_LAG > 0) {
            for (int m = 0; m < documents.length; m++) {
                for (int k = 0; k < K; k++) {
                    theta[m][k] = thetasum[m][k] / numstats;
                }
            }

        } else {
            for (int m = 0; m < documents.length; m++) {
                for (int k = 0; k < K; k++) {
                    theta[m][k] = (nd[m][k] + alpha) / (ndsum[m] + K * alpha);
                }
            }
        }

        return theta;
    }
346292
def _mm_rankings(n_items, data, params):
    """"""
    weights = exp_transform(params)
    wins = np.zeros(n_items, dtype=float)
    denoms = np.zeros(n_items, dtype=float)
    for ranking in data:
        sum_ = weights.take(ranking).sum()
        for i, winner in enumerate(ranking[:-1]):
            wins[winner] += 1
            val = 1.0 / sum_
            for item in ranking[i:]:
                denoms[item] += val
            sum_ -= weights[winner]
    return wins, denoms
1080732
private int computePk2Measure(double[] objectiveScores) {
        LOGGER.fine("Computing the PK2 measure");

        // Compute each Pk2 score and the average score.
        double average = 0;
        for (int k = objectiveScores.length - 1; k > 0; --k) {
            objectiveScores[k] /= objectiveScores[k-1];
            average += objectiveScores[k];
        }
        average /= (objectiveScores.length - 1);

        // Compute the standard deviation of the PK2 scores.
        double stdev = 0;
        for (int k = 1; k < objectiveScores.length; ++k)
            stdev += Math.pow(objectiveScores[k] - average, 2);
        stdev /= (objectiveScores.length - 2);
        stdev = Math.sqrt(stdev);

        // Find the point where the score is the smallest value greater than 1 +
        // stdev of the PK1 scores.
        double referencePoint = 1 + stdev;
        int bestIndex = 0;
        double bestScore = Double.MAX_VALUE;
        for (int k = 1; k < objectiveScores.length; ++k) {
            if (objectiveScores[k] < bestScore &&
                objectiveScores[k] >= referencePoint) {
                bestIndex = k;
                bestScore = objectiveScores[k];
            }
        }

        return bestIndex;
    }
254719
def scores_to_probs(scores, proba, eps=0.01):
    """"""
    if np.any(~proba):
        # Need to convert some of the scores into probabilities
        probs = copy.deepcopy(scores)
        n_class = len(proba)
        for m in range(n_class):
            if not proba[m]:
                #TODO: incorporate threshold (currently assuming zero)
                # find most extreme absolute score
                max_extreme_score = max(np.abs(np.min(scores[:,m])),\
                                    np.abs(np.max(scores[:,m])))
                k = np.log((1-eps)/eps)/max_extreme_score # scale factor
                self._probs[:,m] = expit(k * self.scores[:,m])
        return probs
    else:
        return scores
762008
private int getSubstitutionScore(float[] qv, float[] tv) {
		float score = 0.0f;
		for (int q = 0; q < qv.length; q++) {
			if (qv[q] > 0.0f) {
				for (int t = 0; t < tv.length; t++) {
					if (tv[t] > 0.0f) {
						score += qv[q]*tv[t]*getSubstitutionMatrix().getValue(cslist.get(q), cslist.get(t));
					}
				}
			}
		}
		return Math.round(score);
	}
123371
function getMinMaxValuesCandlestick(arr) {
    let maxValue = Number.MIN_VALUE;
    let minValue = Number.MAX_VALUE;
    arr
      .forEach((d) => {
        if (d.high > maxValue) {
          maxValue = d.high;
        }
        if (d.low < minValue) {
          minValue = d.low;
        }
      });
      return {maxValue, minValue};
  }
902787
def get_below_threshold(umi_quals, quality_encoding,  quality_filter_threshold):
    ''''''
    umi_quals = [x - RANGES[quality_encoding][0] for x in map(ord, umi_quals)]
    below_threshold = [x < quality_filter_threshold for x in umi_quals]
    return below_threshold
960952
def score(self, i):
        """"""
        if self.minimize:
            return self.data[i][0]
        else:
            return self.data[(-1 * i) - 1][0]
1024892
def getErrorBars(expPath, suite):
  
  exps = suite.get_exps(expPath)
  testScores = np.zeros(len(exps))
  noiseScores = np.zeros(len(exps))
  for i,e in enumerate(exps):
    maxTestAccuracy, maxValidationAccuracy, maxBGAccuracy, maxIter, maxTotalAccuracy = bestScore(
      e, suite)
    testScores[i] = maxTestAccuracy
    noiseScores[i] = maxTotalAccuracy
    print(e, maxTestAccuracy, maxTotalAccuracy)

  print("")
  print("Experiment:", expPath, "Number of sub-experiments", len(exps))
  print("test score mean and standard deviation:", testScores.mean(), testScores.std())
  print("noise score mean and standard deviation:", noiseScores.mean(), noiseScores.std())
234903
private void initMatrix(int quality) {
        double[] AANscaleFactor = {1.0, 1.387039845, 1.306562965, 1.175875602,
                1.0, 0.785694958, 0.541196100, 0.275899379};
        int i;
        int j;
        int index;
        int Quality;
        int temp;

// converting quality setting to that specified in the jpeg_quality_scaling
// method in the IJG Jpeg-6a C libraries

        Quality = quality;
        if (Quality <= 0)
            Quality = 1;
        if (Quality > 100)
            Quality = 100;
        if (Quality < 50)
            Quality = 5000 / Quality;
        else
            Quality = 200 - Quality * 2;

// Creating the luminance matrix

        quantum_luminance[0] = 16;
        quantum_luminance[1] = 11;
        quantum_luminance[2] = 10;
        quantum_luminance[3] = 16;
        quantum_luminance[4] = 24;
        quantum_luminance[5] = 40;
        quantum_luminance[6] = 51;
        quantum_luminance[7] = 61;
        quantum_luminance[8] = 12;
        quantum_luminance[9] = 12;
        quantum_luminance[10] = 14;
        quantum_luminance[11] = 19;
        quantum_luminance[12] = 26;
        quantum_luminance[13] = 58;
        quantum_luminance[14] = 60;
        quantum_luminance[15] = 55;
        quantum_luminance[16] = 14;
        quantum_luminance[17] = 13;
        quantum_luminance[18] = 16;
        quantum_luminance[19] = 24;
        quantum_luminance[20] = 40;
        quantum_luminance[21] = 57;
        quantum_luminance[22] = 69;
        quantum_luminance[23] = 56;
        quantum_luminance[24] = 14;
        quantum_luminance[25] = 17;
        quantum_luminance[26] = 22;
        quantum_luminance[27] = 29;
        quantum_luminance[28] = 51;
        quantum_luminance[29] = 87;
        quantum_luminance[30] = 80;
        quantum_luminance[31] = 62;
        quantum_luminance[32] = 18;
        quantum_luminance[33] = 22;
        quantum_luminance[34] = 37;
        quantum_luminance[35] = 56;
        quantum_luminance[36] = 68;
        quantum_luminance[37] = 109;
        quantum_luminance[38] = 103;
        quantum_luminance[39] = 77;
        quantum_luminance[40] = 24;
        quantum_luminance[41] = 35;
        quantum_luminance[42] = 55;
        quantum_luminance[43] = 64;
        quantum_luminance[44] = 81;
        quantum_luminance[45] = 104;
        quantum_luminance[46] = 113;
        quantum_luminance[47] = 92;
        quantum_luminance[48] = 49;
        quantum_luminance[49] = 64;
        quantum_luminance[50] = 78;
        quantum_luminance[51] = 87;
        quantum_luminance[52] = 103;
        quantum_luminance[53] = 121;
        quantum_luminance[54] = 120;
        quantum_luminance[55] = 101;
        quantum_luminance[56] = 72;
        quantum_luminance[57] = 92;
        quantum_luminance[58] = 95;
        quantum_luminance[59] = 98;
        quantum_luminance[60] = 112;
        quantum_luminance[61] = 100;
        quantum_luminance[62] = 103;
        quantum_luminance[63] = 99;

        for (j = 0; j < 64; j++) {
            temp = (quantum_luminance[j] * Quality + 50) / 100;
            if (temp <= 0) temp = 1;
            if (temp > 255) temp = 255;
            quantum_luminance[j] = temp;
        }
        index = 0;
        for (i = 0; i < 8; i++) {
            for (j = 0; j < 8; j++) {
// The divisors for the LL&M method (the slow integer method used in
// jpeg 6a library).  This method is currently (04/04/98) incompletely
// implemented.
//                        DivisorsLuminance[index] = ((double) quantum_luminance[index]) << 3;
// The divisors for the AAN method (the float method used in jpeg 6a library.
                DivisorsLuminance[index] = (1.0 / ((double) quantum_luminance[index] * AANscaleFactor[i] * AANscaleFactor[j] * 8.0));
                index++;
            }
        }


// Creating the chrominance matrix

        quantum_chrominance[0] = 17;
        quantum_chrominance[1] = 18;
        quantum_chrominance[2] = 24;
        quantum_chrominance[3] = 47;
        quantum_chrominance[4] = 99;
        quantum_chrominance[5] = 99;
        quantum_chrominance[6] = 99;
        quantum_chrominance[7] = 99;
        quantum_chrominance[8] = 18;
        quantum_chrominance[9] = 21;
        quantum_chrominance[10] = 26;
        quantum_chrominance[11] = 66;
        quantum_chrominance[12] = 99;
        quantum_chrominance[13] = 99;
        quantum_chrominance[14] = 99;
        quantum_chrominance[15] = 99;
        quantum_chrominance[16] = 24;
        quantum_chrominance[17] = 26;
        quantum_chrominance[18] = 56;
        quantum_chrominance[19] = 99;
        quantum_chrominance[20] = 99;
        quantum_chrominance[21] = 99;
        quantum_chrominance[22] = 99;
        quantum_chrominance[23] = 99;
        quantum_chrominance[24] = 47;
        quantum_chrominance[25] = 66;
        quantum_chrominance[26] = 99;
        quantum_chrominance[27] = 99;
        quantum_chrominance[28] = 99;
        quantum_chrominance[29] = 99;
        quantum_chrominance[30] = 99;
        quantum_chrominance[31] = 99;
        quantum_chrominance[32] = 99;
        quantum_chrominance[33] = 99;
        quantum_chrominance[34] = 99;
        quantum_chrominance[35] = 99;
        quantum_chrominance[36] = 99;
        quantum_chrominance[37] = 99;
        quantum_chrominance[38] = 99;
        quantum_chrominance[39] = 99;
        quantum_chrominance[40] = 99;
        quantum_chrominance[41] = 99;
        quantum_chrominance[42] = 99;
        quantum_chrominance[43] = 99;
        quantum_chrominance[44] = 99;
        quantum_chrominance[45] = 99;
        quantum_chrominance[46] = 99;
        quantum_chrominance[47] = 99;
        quantum_chrominance[48] = 99;
        quantum_chrominance[49] = 99;
        quantum_chrominance[50] = 99;
        quantum_chrominance[51] = 99;
        quantum_chrominance[52] = 99;
        quantum_chrominance[53] = 99;
        quantum_chrominance[54] = 99;
        quantum_chrominance[55] = 99;
        quantum_chrominance[56] = 99;
        quantum_chrominance[57] = 99;
        quantum_chrominance[58] = 99;
        quantum_chrominance[59] = 99;
        quantum_chrominance[60] = 99;
        quantum_chrominance[61] = 99;
        quantum_chrominance[62] = 99;
        quantum_chrominance[63] = 99;

        for (j = 0; j < 64; j++) {
            temp = (quantum_chrominance[j] * Quality + 50) / 100;
            if (temp <= 0) temp = 1;
            if (temp >= 255) temp = 255;
            quantum_chrominance[j] = temp;
        }
        index = 0;
        for (i = 0; i < 8; i++) {
            for (j = 0; j < 8; j++) {
// The divisors for the LL&M method (the slow integer method used in
// jpeg 6a library).  This method is currently (04/04/98) incompletely
// implemented.
//                        DivisorsChrominance[index] = ((double) quantum_chrominance[index]) << 3;
// The divisors for the AAN method (the float method used in jpeg 6a library.
                DivisorsChrominance[index] = (1.0 / ((double) quantum_chrominance[index] * AANscaleFactor[i] * AANscaleFactor[j] * 8.0));
                index++;
            }
        }

// quantum and Divisors are objects used to hold the appropriate matices

        quantum[0] = quantum_luminance;
        Divisors[0] = DivisorsLuminance;
        quantum[1] = quantum_chrominance;
        Divisors[1] = DivisorsChrominance;


    }
420891
def _score_micro_average(self, y, y_pred, classes, n_classes):
        
        # Convert y to binarized array for micro and macro scores
        y = label_binarize(y, classes=classes)
        if n_classes == 2:
            y = np.hstack((1-y, y))

        # Compute micro-average
        self.fpr[MICRO], self.tpr[MICRO], _ = roc_curve(y.ravel(), y_pred.ravel())
        self.roc_auc[MICRO] = auc(self.fpr[MICRO], self.tpr[MICRO])
187327
public int[] getDefalutValuesArray() {
        int[] defaultValues = new int[5];

        defaultValues[0] = GLES20.GL_LINEAR_MIPMAP_NEAREST; // MIN FILTER
        defaultValues[1] = GLES20.GL_LINEAR; // MAG FILTER
        defaultValues[2] = 1; // ANISO FILTER
        defaultValues[3] = GLES20.GL_CLAMP_TO_EDGE; // WRAP S
        defaultValues[4] = GLES20.GL_CLAMP_TO_EDGE; // WRAP T

        return defaultValues;
    }
1153434
def validate_average_best_span():
    """"""
    N = 200
    num_trials = 400
    avg = numpy.zeros(N)
    for i in range(num_trials):
        x, y = smoother_friedman82.build_sample_smoother_problem_friedman82(N=N)
        my_smoother = smoother.perform_smooth(
            x, y, smoother_cls=supersmoother.SuperSmoother
        )
        avg += my_smoother._smoothed_best_spans.smooth_result
        if not (i + 1) % 20:
            print(i + 1)
    avg /= num_trials
    plt.plot(my_smoother.x, avg, '.', label='Average JCV')
    finish_plot()
347014
protected void computeScoreFive( int top[] , int middle[] , int bottom[] , int score[] , int width ) {

		// disparity as the outer loop to maximize common elements in inner loops, reducing redundant calculations
		for( int d = minDisparity; d < maxDisparity; d++ ) {

			// take in account the different in image border between the sub-regions and the effective region
			int indexSrc = (d-minDisparity)*width + (d-minDisparity) + radiusX;
			int indexDst = (d-minDisparity)*width + (d-minDisparity);
			int end = indexSrc + (width-d-4*radiusX);
			while( indexSrc < end ) {
				int s = 0;

				// sample four outer regions at the corners around the center region
				int val0 = top[indexSrc-radiusX];
				int val1 = top[indexSrc+radiusX];
				int val2 = bottom[indexSrc-radiusX];
				int val3 = bottom[indexSrc+radiusX];

				// select the two best scores from outer for regions
				if( val1 < val0 ) {
					int temp = val0;
					val0 = val1;
					val1 = temp;
				}

				if( val3 < val2 ) {
					int temp = val2;
					val2 = val3;
					val3 = temp;
				}

				if( val3 < val0 ) {
					s += val2;
					s += val3;
				} else if( val2 < val1 ) {
					s += val2;
					s += val0;
				} else {
					s += val0;
					s += val1;
				}

				score[indexDst++] = s + middle[indexSrc++];
			}
		}
	}