private static void renderAxes(Graphics2D g2d, float tic, float max) {
    /*
    g2d.setColor(Color.BLACK);
    g2d.setStroke(new BasicStroke(3));
    g2d.setFont(new Font("Arial",Font.PLAIN,20));
    int areaWidth = width - 2*borderWidth;
    int areaHeight = height - 2*borderWidth;
    g2d.drawLine(borderWidth, borderWidth, borderWidth, height-borderWidth);
    g2d.drawLine(borderWidth, height-borderWidth, width-borderWidth, height-borderWidth);
    int fontHeight = g2d.getFontMetrics().getHeight();
    int fontWidth = g2d.getFontMetrics().stringWidth("0.0");
    for (float f = 0; f <= max; f+= tic){
    	int ticY = Math.round((height-borderWidth) - (f/max) * (areaHeight));
    	g2d.drawString(StringUtilities.formatNumber("0.0", f), borderWidth-ticSize-fontWidth, fontHeight / 2 + ticY);
    	g2d.drawLine(borderWidth - ticSize, ticY, borderWidth, ticY);

    	int ticX = Math.round(borderWidth + (f/max) * (areaWidth));
    	g2d.drawString(StringUtilities.formatNumber("0.0", f), ticX - fontWidth/2,height-borderWidth+ticSize+fontHeight);
    	g2d.drawLine(ticX, height-borderWidth, ticX, height-borderWidth+ticSize);
    }
    */
    g2d.setStroke(new BasicStroke(1));
    g2d.setFont(new Font("Arial", Font.PLAIN, 30));
    int areaWidth = width - 2 * borderWidth;
    int areaHeight = height - 2 * borderWidth;
    g2d.setColor(new Color(238, 238, 238));
    g2d.fillRect(borderWidth, borderWidth, areaWidth, areaHeight);
    int fontHeight = g2d.getFontMetrics().getHeight();
    int fontWidth = g2d.getFontMetrics().stringWidth("0.0");

    for (float f = 0; f <= max; f += tic) {
      int ticY = Math.round((height - borderWidth) - (f / max) * (areaHeight));
      g2d.setColor(Color.BLACK);
      g2d.drawString(
          StringUtilities.formatNumber("0.0", f),
          borderWidth - ticSize - fontWidth - 3,
          ticY + (fontHeight / 2) - 5);
      g2d.setColor(new Color(170, 170, 170));
      if (f != 0 && f != max) g2d.drawLine(borderWidth, ticY, width - borderWidth, ticY);

      int ticX = Math.round(borderWidth + (f / max) * (areaWidth));
      g2d.setColor(Color.BLACK);
      g2d.drawString(
          StringUtilities.formatNumber("0.0", f),
          ticX - fontWidth / 2,
          height - borderWidth + ticSize + fontHeight);
      g2d.setColor(new Color(170, 170, 170));
      if (f != 0 && f != max) g2d.drawLine(ticX, borderWidth, ticX, height - borderWidth);
    }
  }
  public static void createROC(ClassifierOutput classifierOutput, String filename) {
    WriteTextFile out = null;
    if (outputROCcsv) {
      out = new WriteTextFile(filename.replace(".gif", ".csv"));
      out.writeln("FPR,TPR");
    }
    BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2d = (Graphics2D) img.getGraphics();
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setColor(Color.WHITE);
    g2d.fillRect(0, 0, width, height);

    renderAxes(g2d, 0.2f, 1f);
    // renderDiagonal(g2d);
    renderROC(g2d, classifierOutput, out);

    if (includeAuCinROC) {
      double auc =
          ClassifierEvaluator.areaUnderCurveConfidenceInterval(classifierOutput).pointEstimate;
      g2d.setColor(Color.black);
      g2d.setFont(new Font("Arial", Font.PLAIN, 50));
      FontMetrics metrics = g2d.getFontMetrics();
      String text = "AUC = " + StringUtilities.formatNumber("0.00", auc);
      int textWidth = metrics.stringWidth(text);
      int textHeight = metrics.getHeight();
      g2d.drawString(
          text, Math.round(width - textWidth - borderWidth), Math.round(height - textHeight) + 7);
    }
    try {
      ImageIO.write(img, "GIF", new File(filename));
    } catch (IOException e) {
      e.printStackTrace();
    }
    if (out != null) out.close();
  }
 public static boolean kristinasChemicalShortTokenFilterRule(
     String term, Set<String> stopwordsForFiltering) {
   term = term.toLowerCase();
   ChemicalSBDtokenizer tokenizer = new ChemicalSBDtokenizer();
   tokenizer.tokenize(term);
   String tokenizedTerm = "";
   for (String token : tokenizer.tokens) {
     tokenizedTerm = tokenizedTerm.concat(token);
   }
   if (tokenizedTerm.length() < minWordSize
       || StringUtilities.isNumber(tokenizedTerm)
       || StringUtilities.isRomanNumeral(tokenizedTerm.toUpperCase())
       || stopwordsForFiltering.contains(tokenizedTerm)) {
     return true;
   }
   return false;
 }