Refine search
/** A textual representation of the confidence. */ public String confidenceGloss() { return new DecimalFormat("0.000").format(confidence); }
public void toString(PrintStream out) { out.println(); out.println("PRECISION (micro average): " + new DecimalFormat("0.000%").format(precisionMicro())); out.println("RECALL (micro average): " + new DecimalFormat("0.000%").format(recallMicro())); out.println("F1 (micro average): " + new DecimalFormat("0.000%").format(f1Micro())); out.println(); out.println("PRECISION (macro average): " + new DecimalFormat("0.000%").format(precisionMacro())); out.println("RECALL (macro average): " + new DecimalFormat("0.000%").format(recallMacro())); out.println("F1 (macro average): " + new DecimalFormat("0.000%").format(f1Macro())); out.println(); }
/** * A helper function for dumping the accuracy of the trained classifier. * * @param classifier The classifier to evaluate. * @param dataset The dataset to evaluate the classifier on. */ public static void dumpAccuracy(Classifier<ClauseSplitter.ClauseClassifierLabel, String> classifier, GeneralDataset<ClauseSplitter.ClauseClassifierLabel, String> dataset) { DecimalFormat df = new DecimalFormat("0.00%"); log("size: " + dataset.size()); log("split count: " + StreamSupport.stream(dataset.spliterator(), false).filter(x -> x.label() == ClauseSplitter.ClauseClassifierLabel.CLAUSE_SPLIT).collect(Collectors.toList()).size()); log("interm count: " + StreamSupport.stream(dataset.spliterator(), false).filter(x -> x.label() == ClauseSplitter.ClauseClassifierLabel.CLAUSE_INTERM).collect(Collectors.toList()).size()); Pair<Double, Double> pr = classifier.evaluatePrecisionAndRecall(dataset, ClauseSplitter.ClauseClassifierLabel.CLAUSE_SPLIT); log("p (split): " + df.format(pr.first)); log("r (split): " + df.format(pr.second)); log("f1 (split): " + df.format(2 * pr.first * pr.second / (pr.first + pr.second))); pr = classifier.evaluatePrecisionAndRecall(dataset, ClauseSplitter.ClauseClassifierLabel.CLAUSE_INTERM); log("p (interm): " + df.format(pr.first)); log("r (interm): " + df.format(pr.second)); log("f1 (interm): " + df.format(2 * pr.first * pr.second / (pr.first + pr.second))); }
public static String printMem(long bytes) { double dbytes = (double) bytes; DecimalFormat df = new DecimalFormat("#.##"); if (dbytes < 1024) { return df.format(bytes); } else if (dbytes < 1024 * 1024) { return df.format(dbytes / 1024); } else if (dbytes < 1024 * 1024 * 1024) { return df.format(dbytes / 1024 / 1024) + "M"; } else if (dbytes < 1024 * 1024 * 1024 * 1024L) { return df.format(dbytes / 1024 / 1024 / 1024) + "G"; } else { return "Too big to show you"; } }
private void printDuration(PrintStream out) { out.print(String.format("%dm", (totalDuration / ONE_MINUTE))); DecimalFormat format = new DecimalFormat("0.000", new DecimalFormatSymbols(locale)); out.println(format.format(((double) (totalDuration % ONE_MINUTE)) / ONE_SECOND) + "s"); }
void writeTitleAndDetails() throws IOException { writeTitle("hourglass.png", getString("Requetes_en_cours")); write("<br/>"); if (rootCurrentContexts.isEmpty()) { writeln("#Aucune_requete_en_cours#"); return; } writeContexts(rootCurrentContexts); writeln("<div align='right'>"); writeln(getFormattedString("nb_requete_en_cours", integerFormat.format(rootCurrentContexts.size()))); writeln("</div>"); }
@Override public String toString() { DecimalFormat df = new DecimalFormat("0.00%"); return "[" + name + "] pred/gold: " + predictedCount + "/" + goldCount + " P: " + df.format(precision) + " R: " + df.format(recall) + " F1: " + df.format(f1()); } }
static void ShowMatrix(double[][] matrix, int numRows, int decimals, boolean newLine) { for( int i = 0; i < numRows; ++i ) { System.out.print(i + ": "); for( int j = 0; j < matrix[i].length; ++j ) { if( matrix[i][j] >= 0.0 ) System.out.print(" "); else System.out.print("-"); System.out.print(_format.format(Math.abs(matrix[i][j])) + " "); } System.out.println(""); } if( newLine == true ) System.out.println(""); }
public static String printMem(long bytes) { double dbytes = (double) bytes; DecimalFormat df = new DecimalFormat("#.##"); if (dbytes < 1024) { return df.format(bytes); } else if (dbytes < 1024 * 1024) { return df.format(dbytes / 1024); } else if (dbytes < 1024 * 1024 * 1024) { return df.format(dbytes / 1024 / 1024) + "M"; } else if (dbytes < 1024 * 1024 * 1024 * 1024L) { return df.format(dbytes / 1024 / 1024 / 1024) + "G"; } else { return "Too big to show you"; } }
static void ShowMatrix(double[][] matrix, int numRows, int decimals, boolean newLine) { for( int i = 0; i < numRows; ++i ) { System.out.print(i + ": "); for( int j = 0; j < matrix[i].length; ++j ) { if( matrix[i][j] >= 0.0 ) System.out.print(" "); else System.out.print("-");; System.out.print(_format.format(Math.abs(matrix[i][j])) + " "); } System.out.println(""); } if( newLine == true ) System.out.println(""); }
public static String formatSimpleDouble(Double value) { try { java.text.DecimalFormat form = new java.text.DecimalFormat("##0.000"); String s = form.format(value); return s; } catch (Exception e) { return "0.000"; } }
static void ShowMatrix(double[][] matrix, int numRows, int decimals, boolean newLine) { for( int i = 0; i < numRows; ++i ) { System.out.print(i + ": "); for( int j = 0; j < matrix[i].length; ++j ) { if( matrix[i][j] >= 0.0 ) System.out.print(" "); else System.out.print("-");; System.out.print(_format.format(Math.abs(matrix[i][j])) + " "); } System.out.println(""); } if( newLine == true ) System.out.println(""); }
public static String formatSimpleDouble(Double value) { try { java.text.DecimalFormat form = new java.text.DecimalFormat("##0.000"); String s = form.format(value); return s; } catch (Exception e) { return "0.000"; } }
public static String toFileSizeString(long fileSize) { DecimalFormat df = new DecimalFormat("0.00"); String fileSizeString; if (fileSize < KB) { fileSizeString = fileSize + "B"; } else if (fileSize < MB) { fileSizeString = df.format((double) fileSize / KB) + "K"; } else if (fileSize < GB) { fileSizeString = df.format((double) fileSize / MB) + "M"; } else { fileSizeString = df.format((double) fileSize / GB) + "G"; } return fileSizeString; }
public static double formatDoubleDecPoint2(Double value) { try { java.text.DecimalFormat form = new java.text.DecimalFormat("##.00"); String s = form.format(value); return Double.valueOf(s); } catch (Exception e) { return 0.0; } }