コード例 #1
0
ファイル: Evaluate.java プロジェクト: Ovadia/workspace
  public static void main(String[] args) {

    String s = "5*Toke*10";

    Hashtable<String, Double> Ov = new Hashtable();
    Ov.put("Toke", 10.0);

    Tokenizer myToken = new Tokenizer(s);
    IntoPost ITP = new IntoPost(myToken);
    TheQueue<String> The = ITP.translate();
    Evaluate Eval = new Evaluate(The);
    double x = Eval.evaluate(Ov);
    System.out.println(x);
  }
コード例 #2
0
ファイル: Evaluate.java プロジェクト: GeorgeVacek/PairHMM
  public static void main(final String[] argv) throws IOException {

    Set<String> args = new HashSet<String>(Arrays.asList(argv));
    if (args.size() < 1) {
      throw new RuntimeException(
          "\r\nYou must specify a file name for input.\n"
              + "filename \n ----------------------------\n"
              + "Run with -d or --debug for debug output");
    } else {
      final Evaluate evaluate = new Evaluate(args);
      final List<String> testFiles = new LinkedList<String>();

      final boolean noCaching = args.contains("--nocache");

      for (String arg : args) {
        if (!arg.startsWith("-")) {
          logger.info("Adding test dataset: " + arg);
          testFiles.add(arg);
        }
      }

      for (final String testSet : testFiles) {
        logger.info("Using " + testSet + " tests");
        evaluate.initializeHMMs(args);
        final Iterator<PairHMM> pairHMMIterator = evaluate.pairHMM.iterator();
        while (pairHMMIterator.hasNext()) {
          final PairHMM hmm = pairHMMIterator.next();
          final String hmmName = hmm.getClass().getSimpleName();
          final String[] testSplit = testSet.split("/"); // get rid of the file path (if any)
          final String testName =
              testSplit[testSplit.length - 1].split("\\.")[0]; // get rid of the file extension
          logger.info("Running " + hmmName);
          evaluate.runTests(hmm, createIteratorFor(testSet), hmmName, testName, noCaching);
          pairHMMIterator.remove();
        }
        logger.info("Finished all HMMs for " + testSet + " tests");
      }
    }
  }