/** Compute the sample (unbiased estimator) standard deviation following: * * Computing Deviations: Standard Accuracy * Tony F. Chan and John Gregg Lewis * Stanford University * Communications of ACM September 1979 of Volume 22 the ACM Number 9 * * The "two-pass" method from the paper; supposed to have better * numerical properties than the textbook summation/sqrt. To me * this looks like the textbook method, but I ain't no numerical * methods guy. */ public static double stddev(int[] X) { int m = X.length; if ( m<=1 ) { return 0; } double xbar = avg(X); double s2 = 0.0; for (int i=0; i<m; i++){ s2 += (X[i] - xbar)*(X[i] - xbar); } s2 = s2/(m-1); return Math.sqrt(s2); }
public static void writeReport(String filename, String data) throws IOException { String absoluteFilename = getAbsoluteFileName(filename); File f = new File(absoluteFilename); File parent = f.getParentFile(); parent.mkdirs(); // ensure parent dir exists // write file FileOutputStream fos = new FileOutputStream(f, true); // append BufferedOutputStream bos = new BufferedOutputStream(fos); PrintStream ps = new PrintStream(bos); ps.println(data); ps.close(); bos.close(); fos.close(); }
while (true){ option = getOption()[0]; Stats s = new Stats(data); switch (option) { case "add": //data.put(getOption()[1], getValues()); System.out.println("add"); break; case "set": System.out.println("set"); break; case "print": System.out.println(Arrays.toString(data)); break; case "sum": System.out.println(s.sum()); break; case "mean": System.out.println(s.mean()); break; case "stdev": System.out.println(s.standardDeviation()); break; case "median": System.out.println(s.median()); break; case "primes": System.out.println(s.primes()); break; case "summary": System.out.println("summary"); break; //case "test": System.out.println(Arrays.toString(getValues())); case "quit": break; } }
buf.append(numLL1); buf.append('\t'); buf.append(Stats.min(depths)); buf.append('\t'); buf.append(Stats.max(depths)); buf.append('\t'); buf.append(Stats.avg(depths)); buf.append('\t'); buf.append(Stats.stddev(depths)); buf.append('\t'); buf.append(Stats.min(acyclicDFAStates)); buf.append('\t'); buf.append(Stats.max(acyclicDFAStates)); buf.append('\t'); buf.append(Stats.avg(acyclicDFAStates)); buf.append('\t'); buf.append(Stats.stddev(acyclicDFAStates)); buf.append('\t'); buf.append(Stats.sum(acyclicDFAStates)); buf.append('\t'); buf.append(Stats.min(cyclicDFAStates)); buf.append('\t'); buf.append(Stats.max(cyclicDFAStates)); buf.append('\t'); buf.append(Stats.avg(cyclicDFAStates)); buf.append('\t'); buf.append(Stats.stddev(cyclicDFAStates)); buf.append('\t'); buf.append(Stats.sum(cyclicDFAStates));
Stats.writeReport(GrammarReport.GRAMMAR_STATS_FILENAME, greport.toNotifyString());
Stats.writeReport(GrammarReport.GRAMMAR_STATS_FILENAME, greport.toNotifyString());
/** Compute the sample (unbiased estimator) standard deviation following: * * Computing Deviations: Standard Accuracy * Tony F. Chan and John Gregg Lewis * Stanford University * Communications of ACM September 1979 of Volume 22 the ACM Number 9 * * The "two-pass" method from the paper; supposed to have better * numerical properties than the textbook summation/sqrt. To me * this looks like the textbook method, but I ain't no numerical * methods guy. */ public static double stddev(int[] X) { int m = X.length; if ( m<=1 ) { return 0; } double xbar = avg(X); double s2 = 0.0; for (int i=0; i<m; i++){ s2 += (X[i] - xbar)*(X[i] - xbar); } s2 = s2/(m-1); return Math.sqrt(s2); }
public static void writeReport(String filename, String data) throws IOException { String absoluteFilename = getAbsoluteFileName(filename); File f = new File(absoluteFilename); File parent = f.getParentFile(); parent.mkdirs(); // ensure parent dir exists // write file FileOutputStream fos = new FileOutputStream(f, true); // append BufferedOutputStream bos = new BufferedOutputStream(fos); PrintStream ps = new PrintStream(bos); ps.println(data); ps.close(); bos.close(); fos.close(); }
Stats.writeReport(GrammarReport.GRAMMAR_STATS_FILENAME, greport.toNotifyString());
/** Compute the sample (unbiased estimator) standard deviation following: * * Computing Deviations: Standard Accuracy * Tony F. Chan and John Gregg Lewis * Stanford University * Communications of ACM September 1979 of Volume 22 the ACM Number 9 * * The "two-pass" method from the paper; supposed to have better * numerical properties than the textbook summation/sqrt. To me * this looks like the textbook method, but I ain't no numerical * methods guy. */ public static double stddev(int[] X) { int m = X.length; if ( m<=1 ) { return 0; } double xbar = avg(X); double s2 = 0.0; for (int i=0; i<m; i++){ s2 += (X[i] - xbar)*(X[i] - xbar); } s2 = s2/(m-1); return Math.sqrt(s2); }
public static void writeReport(String filename, String data) throws IOException { String absoluteFilename = getAbsoluteFileName(filename); File f = new File(absoluteFilename); File parent = f.getParentFile(); parent.mkdirs(); // ensure parent dir exists // write file FileOutputStream fos = new FileOutputStream(f, true); // append BufferedOutputStream bos = new BufferedOutputStream(fos); PrintStream ps = new PrintStream(bos); ps.println(data); ps.close(); bos.close(); fos.close(); }
Stats.writeReport(GrammarReport.GRAMMAR_STATS_FILENAME, greport.toNotifyString());
/** Compute the sample (unbiased estimator) standard deviation following: * * Computing Deviations: Standard Accuracy * Tony F. Chan and John Gregg Lewis * Stanford University * Communications of ACM September 1979 of Volume 22 the ACM Number 9 * * The "two-pass" method from the paper; supposed to have better * numerical properties than the textbook summation/sqrt. To me * this looks like the textbook method, but I ain't no numerical * methods guy. */ public static double stddev(int[] X) { int m = X.length; if ( m<=1 ) { return 0; } double xbar = avg(X); double s2 = 0.0; for (int i=0; i<m; i++){ s2 += (X[i] - xbar)*(X[i] - xbar); } s2 = s2/(m-1); return Math.sqrt(s2); }
public static void writeReport(String filename, String data) throws IOException { String absoluteFilename = getAbsoluteFileName(filename); File f = new File(absoluteFilename); File parent = f.getParentFile(); parent.mkdirs(); // ensure parent dir exists // write file FileOutputStream fos = new FileOutputStream(f, true); // append BufferedOutputStream bos = new BufferedOutputStream(fos); PrintStream ps = new PrintStream(bos); ps.println(data); ps.close(); bos.close(); fos.close(); }
/** Compute the sample (unbiased estimator) standard deviation following: * * Computing Deviations: Standard Accuracy * Tony F. Chan and John Gregg Lewis * Stanford University * Communications of ACM September 1979 of Volume 22 the ACM Number 9 * * The "two-pass" method from the paper; supposed to have better * numerical properties than the textbook summation/sqrt. To me * this looks like the textbook method, but I ain't no numerical * methods guy. */ public static double stddev(int[] X) { int m = X.length; if ( m<=1 ) { return 0; } double xbar = avg(X); double s2 = 0.0; for (int i=0; i<m; i++){ s2 += (X[i] - xbar)*(X[i] - xbar); } s2 = s2/(m-1); return Math.sqrt(s2); }
public static void writeReport(String filename, String data) throws IOException { String absoluteFilename = getAbsoluteFileName(filename); File f = new File(absoluteFilename); File parent = f.getParentFile(); parent.mkdirs(); // ensure parent dir exists // write file FileOutputStream fos = new FileOutputStream(f, true); // append BufferedOutputStream bos = new BufferedOutputStream(fos); PrintStream ps = new PrintStream(bos); ps.println(data); ps.close(); bos.close(); fos.close(); }
/** Compute the sample (unbiased estimator) standard deviation following: * * Computing Deviations: Standard Accuracy * Tony F. Chan and John Gregg Lewis * Stanford University * Communications of ACM September 1979 of Volume 22 the ACM Number 9 * * The "two-pass" method from the paper; supposed to have better * numerical properties than the textbook summation/sqrt. To me * this looks like the textbook method, but I ain't no numerical * methods guy. */ public static double stddev(int[] X) { int m = X.length; if ( m<=1 ) { return 0; } double xbar = avg(X); double s2 = 0.0; for (int i=0; i<m; i++){ s2 += (X[i] - xbar)*(X[i] - xbar); } s2 = s2/(m-1); return Math.sqrt(s2); }