Get the precision recall curve as array.
return[0] = threshold array<br>
return[1] = precision array<br>
return[2] = recall array<br>

@return
551824
public PrecisionRecallCurve getPrecisionRecallCurve() {

        if (prCurve != null) {
            return prCurve;
        }

        double[] thresholdOut;
        double[] precisionOut;
        double[] recallOut;
        int[] tpCountOut;
        int[] fpCountOut;
        int[] fnCountOut;

        if (isExact) {
            INDArray pl = getProbAndLabelUsed();
            INDArray sorted = Nd4j.sortRows(pl, 0, false);
            INDArray isPositive = sorted.getColumn(1,true);

            INDArray cumSumPos = isPositive.cumsum(-1);
            val length = sorted.size(0);

            /*
            Sort descending. As we iterate: decrease probability threshold T... all values <= T are predicted
            as class 0, all others are predicted as class 1

            Precision:  sum(TP) / sum(predicted pos at threshold)
            Recall:     sum(TP) / total actual positives

            predicted positive at threshold: # values <= threshold, i.e., just i
             */

            INDArray t = Nd4j.create(DataType.DOUBLE, length + 2, 1);
            t.put(new INDArrayIndex[]{interval(1, length + 1), all()}, sorted.getColumn(0,true));

            INDArray linspace = Nd4j.linspace(1, length, length, DataType.DOUBLE);
            INDArray precision = cumSumPos.castTo(DataType.DOUBLE).div(linspace.reshape(cumSumPos.shape()));
            INDArray prec = Nd4j.create(DataType.DOUBLE, length + 2, 1);
            prec.put(new INDArrayIndex[]{interval(1, length + 1), all()}, precision);

            //Recall/TPR
            INDArray rec = Nd4j.create(DataType.DOUBLE, length + 2, 1);
            rec.put(new INDArrayIndex[]{interval(1, length + 1), all()},
                    cumSumPos.div(countActualPositive));

            //Edge cases
            t.putScalar(0, 0, 1.0);
            prec.putScalar(0, 0, 1.0);
            rec.putScalar(0, 0, 0.0);
            prec.putScalar(length + 1, 0, cumSumPos.getDouble(cumSumPos.length() - 1) / length);
            rec.putScalar(length + 1, 0, 1.0);

            thresholdOut = t.data().asDouble();
            precisionOut = prec.data().asDouble();
            recallOut = rec.data().asDouble();

            //Counts. Note the edge cases
            tpCountOut = new int[thresholdOut.length];
            fpCountOut = new int[thresholdOut.length];
            fnCountOut = new int[thresholdOut.length];

            for (int i = 1; i < tpCountOut.length - 1; i++) {
                tpCountOut[i] = cumSumPos.getInt(i - 1);
                fpCountOut[i] = i - tpCountOut[i]; //predicted positive - true positive
                fnCountOut[i] = (int) countActualPositive - tpCountOut[i];
            }

            //Edge cases: last idx -> threshold of 0.0, all predicted positive
            tpCountOut[tpCountOut.length - 1] = (int) countActualPositive;
            fpCountOut[tpCountOut.length - 1] = (int) (exampleCount - countActualPositive);
            fnCountOut[tpCountOut.length - 1] = 0;
            //Edge case: first idx -> threshold of 1.0, all predictions negative
            tpCountOut[0] = 0;
            fpCountOut[0] = 0; //(int)(exampleCount - countActualPositive);  //All negatives are predicted positive
            fnCountOut[0] = (int) countActualPositive;

            //Finally: 2 things to do
            //(a) Reverse order: lowest to highest threshold
            //(b) remove unnecessary/rendundant points (doesn't affect graph or AUPRC)

            ArrayUtils.reverse(thresholdOut);
            ArrayUtils.reverse(precisionOut);
            ArrayUtils.reverse(recallOut);
            ArrayUtils.reverse(tpCountOut);
            ArrayUtils.reverse(fpCountOut);
            ArrayUtils.reverse(fnCountOut);

            if (rocRemoveRedundantPts) {
                Pair<double[][], int[][]> pair = removeRedundant(thresholdOut, precisionOut, recallOut, tpCountOut,
                        fpCountOut, fnCountOut);
                double[][] temp = pair.getFirst();
                int[][] temp2 = pair.getSecond();
                thresholdOut = temp[0];
                precisionOut = temp[1];
                recallOut = temp[2];
                tpCountOut = temp2[0];
                fpCountOut = temp2[1];
                fnCountOut = temp2[2];
            }
        } else {
            thresholdOut = new double[counts.size()];
            precisionOut = new double[counts.size()];
            recallOut = new double[counts.size()];
            tpCountOut = new int[counts.size()];
            fpCountOut = new int[counts.size()];
            fnCountOut = new int[counts.size()];

            int i = 0;
            for (Map.Entry<Double, CountsForThreshold> entry : counts.entrySet()) {
                double t = entry.getKey();
                CountsForThreshold c = entry.getValue();
                long tpCount = c.getCountTruePositive();
                long fpCount = c.getCountFalsePositive();
                //For edge cases: http://stats.stackexchange.com/questions/1773/what-are-correct-values-for-precision-and-recall-in-edge-cases
                //precision == 1 when FP = 0 -> no incorrect positive predictions
                //recall == 1 when no dataset positives are present (got all 0 of 0 positives)
                double precision;
                if (tpCount == 0 && fpCount == 0) {
                    //At this threshold: no predicted positive cases
                    precision = 1.0;
                } else {
                    precision = tpCount / (double) (tpCount + fpCount);
                }

                double recall;
                if (countActualPositive == 0) {
                    recall = 1.0;
                } else {
                    recall = tpCount / ((double) countActualPositive);
                }

                thresholdOut[i] = c.getThreshold();
                precisionOut[i] = precision;
                recallOut[i] = recall;

                tpCountOut[i] = (int) tpCount;
                fpCountOut[i] = (int) fpCount;
                fnCountOut[i] = (int) (countActualPositive - tpCount);
                i++;
            }
        }

        prCurve = new PrecisionRecallCurve(thresholdOut, precisionOut, recallOut, tpCountOut, fpCountOut, fnCountOut,
                exampleCount);
        return prCurve;
    }
770102
def getData(self):
        
        # organize the points into segments
        # 1. make sure there is an on curve
        haveOnCurve = False
        for point in self._points:
            if point.segmentType is not None:
                haveOnCurve = True
                break
        # 2. move the off curves to front of the list
        if haveOnCurve:
            _prepPointsForSegments(self._points)
        # 3. ignore double points on start and end
        firstPoint = self._points[0]
        lastPoint = self._points[-1]
        if firstPoint.segmentType is not None and lastPoint.segmentType is not None:
            if firstPoint.coordinates == lastPoint.coordinates:
                if (firstPoint.segmentType in ["line", "move"]):
                    del self._points[0]
                else:
                    raise AssertionError("Unhandled point type sequence")
        # done
        return self._points
507425
private int[] getMagnitudeArray() {
        if (offset > 0 || value.length != intLen)
            return Arrays.copyOfRange(value, offset, offset + intLen);
        return value;
    }
1123572
public double[] getSingularValues() {
        double ret[] = new double[W.numCols()];

        for (int i = 0; i < ret.length; i++) {
            ret[i] = getSingleValue(i);
        }
        return ret;
    }
590198
public double[] calcPRF() {

		/**
		 * 估计的中正确的
		 */
		int mpc = 0;
		/**
		 * 估计的
		 */
		int  mp = 0;		
		/**
		 * 正确的
		 */
		int  mc = 0;

		/**
		 * OOV
		 */
		int oov = 0;
		int coov =0;

		for(int i=0;i<entityCs.size();i++){
			LinkedList<Entity>  cList =  entityCs.get(i);
			LinkedList<Entity>  pList =  entityPs.get(i);
			LinkedList<Entity>  cpList =  entityCinPs.get(i);

			for(Entity entity:cList){				
				if(dict!=null&&dict.size()>0){
					String s = entity.getEntityStr();
					if(!dict.contains(s)){
						oov++;
					}
				}
			}

			for(Entity entity:cpList){				
				if(dict!=null&&dict.size()>0){
					String s = entity.getEntityStr();
					if(!dict.contains(s)){
						coov++;
					}
				}
			}



			mc+=cList.size();
			mp+=pList.size();
			mpc+=cpList.size();
		}

		double pre =0;
		if(mp!=0)
			pre = (double) mpc/(double) mp*100;
		double recall = 0;
		if(mc!=0)
			recall = (double)mpc/(double)mc*100;	
		
		double FB1=0;
		if(recall+pre!=0)
			FB1 = (pre*recall*2)/(recall+pre);
		
		double oovrecall = 0;
		if(oov!=0)
			oovrecall = (double)coov/(double)oov*100;		

		return new double[]{pre,recall,FB1,oovrecall};

	}
1322605
def f1(y, z):
    
    _recall = recall(y, z)
    _prec = precision(y, z)
    return 2 * (_prec * _recall) / (_prec + _recall)
641408
public int[] getPositions() {
    int[] list;
    if (assumeSinglePosition) {
      list = new int[1];
      list[0] = super.startPosition();
      return list;
    } else {
      try {
        processEncodedPayload();
        list = mtasPosition.getPositions();
        if (list != null) {
          return mtasPosition.getPositions();
        }
      } catch (IOException e) {
        log.debug(e);
        // do nothing
      }
      int start = super.startPosition();
      int end = super.endPosition();
      list = new int[end - start];
      for (int i = start; i < end; i++)
        list[i - start] = i;
      return list;
    }
  }
41919
public float[] getClusterMean(){
        float[] normedCurrentLocation = new float[mCurrentMeanLocation.length];
        for ( int i = 0; i < mCurrentMeanLocation.length; i++ ){
            normedCurrentLocation[i] = mCurrentMeanLocation[i]/((float)mClusterItems.size());
        }
        return normedCurrentLocation;
    }
17100
public double[] getColumnPackedCopy()
    {
        double[] vals = new double[m * n];
        for (int i = 0; i < m; i++)
        {
            for (int j = 0; j < n; j++)
            {
                vals[i + j * m] = A[i][j];
            }
        }
        return vals;
    }
232007
public Pixel[] pixels() {
        Pixel[] pixels = new Pixel[count()];
        Point[] points = points();
        for (int k = 0; k < points.length; k++) {
            pixels[k] = pixel(points[k]);
        }
        return pixels;
    }
57595
private ArrayList<String> calculateRangeFromParameters(){
        ArrayList<String>allTheValues = new ArrayList<String>();
        int minSampleSizeInteger = Integer.parseInt(minSampleSize);
        int maxSampleSizeInteger = Integer.parseInt(maxSampleSize);
        int incrementInteger = Integer.parseInt(increment);
        for(int i=minSampleSizeInteger; i<maxSampleSizeInteger; i=i+incrementInteger){
            String value = Integer.toString(i) + " - " + Integer.toString(i+incrementInteger);
            allTheValues.add(value);
        }
        return allTheValues;
    }
863206
public double optimalCwa() {
    double acc = 0;
    for (int recall = 1; recall <= numSamples(); recall++) {
      acc += precision(recall) / (double) recall;
    }
    return acc / numSamples();
  }
153400
public IntBitSet[] epsilonClosures() {
        int si;
        int nextSize;
        IntBitSet[] result;
        IntBitSet tmp;
        int[] size;
        boolean repeat;

        result = new IntBitSet[used];
        size = new int[used];
        for (si = 0; si < used; si++) {
            tmp = new IntBitSet();
            states[si].epsilonClosure(tmp);
            result[si] = tmp;
            size[si] = tmp.size();
        }

        do {
            repeat = false;
            for (si = 0; si < used; si++) {
                result[si].addAllSets(result);
                nextSize = result[si].size();
                if (nextSize > size[si]) {
                    size[si] = nextSize;
                    repeat = true;
                }
            }
        } while (repeat);

        return result;
    }
468876
public int[] getOccurrences() {
    int[] res = new int[this.occurrences.size()];
    for (int i = 0; i < this.occurrences.size(); i++) {
      res[i] = this.occurrences.get(i);
    }
    return res;
  }
1034779
public RocCurve getRocCurve() {
        if (rocCurve != null) {
            return rocCurve;
        }

        if (isExact) {
            //Sort ascending. As we decrease threshold, more are predicted positive.
            //if(prob <= threshold> predict 0, otherwise predict 1
            //So, as we iterate from i=0..length, first 0 to i (inclusive) are predicted class 1, all others are predicted class 0
            INDArray pl = getProbAndLabelUsed();
            INDArray sorted = Nd4j.sortRows(pl, 0, false);
            INDArray isPositive = sorted.getColumn(1,true);
            INDArray isNegative = sorted.getColumn(1,true).rsub(1.0);

            INDArray cumSumPos = isPositive.cumsum(-1);
            INDArray cumSumNeg = isNegative.cumsum(-1);
            val length = sorted.size(0);

            INDArray t = Nd4j.create(DataType.DOUBLE, length + 2, 1);
            t.put(new INDArrayIndex[]{interval(1, length + 1), all()}, sorted.getColumn(0,true));

            INDArray fpr = Nd4j.create(DataType.DOUBLE, length + 2, 1);
            fpr.put(new INDArrayIndex[]{interval(1, length + 1), all()},
                    cumSumNeg.div(countActualNegative));

            INDArray tpr = Nd4j.create(DataType.DOUBLE, length + 2, 1);
            tpr.put(new INDArrayIndex[]{interval(1, length + 1), all()},
                    cumSumPos.div(countActualPositive));

            //Edge cases
            t.putScalar(0, 0, 1.0);
            fpr.putScalar(0, 0, 0.0);
            tpr.putScalar(0, 0, 0.0);
            fpr.putScalar(length + 1, 0, 1.0);
            tpr.putScalar(length + 1, 0, 1.0);


            double[] x_fpr_out = fpr.data().asDouble();
            double[] y_tpr_out = tpr.data().asDouble();
            double[] tOut = t.data().asDouble();

            //Note: we can have multiple FPR for a given TPR, and multiple TPR for a given FPR
            //These can be omitted, without changing the area (as long as we keep the edge points)
            if (rocRemoveRedundantPts) {
                Pair<double[][], int[][]> p = removeRedundant(tOut, x_fpr_out, y_tpr_out, null, null, null);
                double[][] temp = p.getFirst();
                tOut = temp[0];
                x_fpr_out = temp[1];
                y_tpr_out = temp[2];
            }

            this.rocCurve = new RocCurve(tOut, x_fpr_out, y_tpr_out);

            return rocCurve;
        } else {

            double[][] out = new double[3][thresholdSteps + 1];
            int i = 0;
            for (Map.Entry<Double, CountsForThreshold> entry : counts.entrySet()) {
                CountsForThreshold c = entry.getValue();
                double tpr = c.getCountTruePositive() / ((double) countActualPositive);
                double fpr = c.getCountFalsePositive() / ((double) countActualNegative);

                out[0][i] = c.getThreshold();
                out[1][i] = fpr;
                out[2][i] = tpr;
                i++;
            }
            return new RocCurve(out[0], out[1], out[2]);
        }
    }
262768
public int[] getNonZeroIndices() {
        int[] nz = new int[negativeDimensions.length 
                           + positiveDimensions.length];
        System.arraycopy(negativeDimensions, 0, nz, 
                         0, negativeDimensions.length);
        System.arraycopy(positiveDimensions, 0, nz, 
                         negativeDimensions.length, positiveDimensions.length);
        return nz;
    }
71390
public ThresholdAlgorithm getAverageThresholdAlgorithm(){
        Collection<ThresholdAlgorithm> c = this.allThreadThresholdAlgorithms.values();
        if(c.isEmpty()){
            return null;
        }
        if(c.size() == 1){
            return c.iterator().next();
        }
        Iterator<ThresholdAlgorithm> iter = c.iterator();
        ThresholdAlgorithmReducer r = null;
        while(iter.hasNext()){
            ThresholdAlgorithm ta = iter.next();
            if(r == null){
                r = ta.newReducer();
            }
            r.add(ta);
        }
        ThresholdAlgorithm ta = r.getFinalResult();

        //Remove the old instances in preparation for use in next epoch, if required
        thresholdAlgorithm = new ThreadLocal<>();
        allThreadThresholdAlgorithms.clear();

        return ta;
    }