/** * Get the value of the maximum entry. * * @return the value of the maximum entry or {@code NaN} if all * entries are {@code NaN}. */ public double getMaxValue() { final int maxIndex = getMaxIndex(); return maxIndex < 0 ? Double.NaN : getEntry(maxIndex); }
int mlIdx = probabilities.getMaxIndex(); double pred = quantizer.getIndexValue(mlIdx); if (includeDetails) {
/** * Get the value of the maximum entry. * * @return the value of the maximum entry or {@code NaN} if all * entries are {@code NaN}. */ public double getMaxValue() { final int maxIndex = getMaxIndex(); return maxIndex < 0 ? Double.NaN : getEntry(maxIndex); }
/** * Get the value of the maximum entry. * * @return the value of the maximum entry or {@code NaN} if all * entries are {@code NaN}. */ public double getMaxValue() { final int maxIndex = getMaxIndex(); return maxIndex < 0 ? Double.NaN : getEntry(maxIndex); }
/** * * @param forwardPath lattice of forwardPath * @param backwardPath lattice of backwardPath * @param nBestList array of arraylists (of string type) with n-best list for each entity span * @return best forward + best backward path */ public String bestMergedPath(double[][] forwardPath, double[][] backwardPath, List<String>[] nBestList) { int length = forwardPath.length; for (int i = 0; i < forwardPath.length; i++) { for (int j = 0; j < nBestList[i].size(); j++) { //System.out.println(forwardPath[i][j] + ", " + backwardPath[length - 1 - i][j] + ": " + nBestList[i].get(j)); forwardPath[i][j] += backwardPath[length - 1 - i][j]; } } StringBuilder bestPath = new StringBuilder(); for (int i = 0; i < forwardPath.length; i++) { RealVector realVector = new ArrayRealVector(forwardPath[i]); int bestPathIndex = realVector.getMaxIndex(); bestPath.append(nBestList[i].get(bestPathIndex)); bestPath.append(CANDIDATE_DELIMITER); } return bestPath.toString(); }
/** * * @param nBestList an array of arraylists of wiki entities; for each entity span we have a list of candidate * wikilinks (nbest list) * @param surfaceStrings an array of entity spans * @return String of coherent entities */ public String bestForwardPath(List<String>[] nBestList, String[] surfaceStrings) { DPSearch forwardPath = dynamicProgrammingSearch(nBestList, surfaceStrings); RealVector realVector = new ArrayRealVector(forwardPath.logSimilarity[surfaceStrings.length - 1]); int bestPathIndex = realVector.getMaxIndex(); return forwardPath.path[surfaceStrings.length - 1][bestPathIndex]; }
int bestPathIndex = realVector.getMaxIndex();
int mlIdx = probabilities.getMaxIndex(); double pred = quantizer.getIndexValue(mlIdx); if (includeDetails) {