Ejemplo n.º 1
0
  /**
   * Return a string representation of the rules.
   *
   * @param databaseSize the number of transactions in the database where the rules were found.
   */
  public String toString(int databaseSize) {
    StringBuffer buffer = new StringBuffer(" ------- ");
    buffer.append(name);
    buffer.append(" -------\n");
    int i = 0;
    for (Rule rule : rules) {
      //			System.out.println("  L" + j + " ");
      buffer.append("   rule ");
      buffer.append(i);
      buffer.append(":  ");
      buffer.append(rule.toString());
      buffer.append("support :  ");
      buffer.append(rule.getRelativeSupport(databaseSize));

      buffer.append(" (");
      buffer.append(rule.getAbsoluteSupport());
      buffer.append("/");
      buffer.append(databaseSize);
      buffer.append(") ");
      buffer.append("confidence :  ");
      buffer.append(rule.getConfidence());
      buffer.append("\n");
      i++;
    }
    return buffer.toString();
  }
Ejemplo n.º 2
0
  /**
   * Return a string representation of this list of rules
   *
   * @param databaseSize the number of transactions in the database where the rules were found.
   * @return a string
   */
  public String toString(int databaseSize) {
    // create a string buffer
    StringBuffer buffer = new StringBuffer(" ------- ");
    buffer.append(name);
    buffer.append(" -------\n");
    int i = 0;
    // for each rule
    for (Rule rule : rules) {
      // append the rule, its support and confidence.
      buffer.append("   rule ");
      buffer.append(i);
      buffer.append(":  ");
      buffer.append(rule.toString());
      buffer.append("support :  ");
      buffer.append(rule.getRelativeSupport(databaseSize));

      buffer.append(" (");
      buffer.append(rule.getAbsoluteSupport());
      buffer.append("/");
      buffer.append(databaseSize);
      buffer.append(") ");
      buffer.append("confidence :  ");
      buffer.append(rule.getConfidence());
      buffer.append("\n");
      i++;
    }
    return buffer.toString(); // return the string
  }
Ejemplo n.º 3
0
 public String toString(int objectsCount) {
   StringBuffer buffer = new StringBuffer(" ------- " + name + " -------\n");
   int i = 0;
   for (Rule rule : rules) {
     buffer.append("  rule ");
     buffer.append(i);
     buffer.append(":  ");
     buffer.append(rule.toString());
     //			buffer.append("supp: ");
     //			buffer.append(rule.getRelativeSupport(objectsCount));
     //			buffer.append(" (");
     //			buffer.append(rule.getAbsoluteSupport());
     //			buffer.append("/");
     //			buffer.append(objectsCount);
     //			buffer.append(")   ");
     //			buffer.append("conf: ");
     //			buffer.append(rule.getConfidence());
     buffer.append("  seqSupp: ");
     buffer.append(rule.getSequentialSupport(objectsCount));
     buffer.append(" (");
     buffer.append(rule.getAbsoluteSeqSupport());
     buffer.append("/");
     buffer.append(objectsCount);
     buffer.append("  seqConf: ");
     buffer.append(rule.getSequentialConfidence());
     buffer.append(" (");
     buffer.append(rule.getAbsoluteSupport());
     buffer.append("/");
     buffer.append(rule.getItemset1().getAbsoluteSupport());
     buffer.append("\n");
     i++;
   }
   buffer.append("--------------------------------\n");
   return buffer.toString();
 }
Ejemplo n.º 4
0
 public void printRules(int objectsCount) {
   System.out.println(" ------- " + name + " -------");
   int i = 0;
   for (Rule rule : rules) {
     System.out.print("  rule " + i + ":  ");
     rule.print();
     //			System.out.print("supp: " + rule.getRelativeSupport(objectsCount) +
     //					" (" + rule.getAbsoluteSupport() + "/" + objectsCount + ")  ");
     //			System.out.print("conf: " + rule.getConfidence());
     System.out.print(
         " seqSupp: "
             + rule.getSequentialSupport(objectsCount)
             + " ("
             + rule.getAbsoluteSeqSupport()
             + "/"
             + objectsCount
             + ") ");
     System.out.print(
         " seqConf: "
             + rule.getSequentialConfidence()
             + " ("
             + rule.getAbsoluteSupport()
             + "/"
             + rule.getItemset1().getAbsoluteSupport()
             + ") ");
     System.out.println("");
     i++;
   }
   System.out.println(" --------------------------------");
 }
Ejemplo n.º 5
0
 /**
  * Print the rules to System.out
  *
  * @param databaseSize the number of transactions in the database where the rules were found.
  */
 public void printRules(int databaseSize) {
   System.out.println(" ------- " + name + " -------");
   int i = 0;
   for (Rule rule : rules) {
     System.out.print("  rule " + i + ":  " + rule.toString());
     System.out.print(
         "support :  "
             + rule.getRelativeSupport(databaseSize)
             + " ("
             + rule.getAbsoluteSupport()
             + "/"
             + databaseSize
             + ") ");
     System.out.print("confidence :  " + rule.getConfidence());
     System.out.println("");
     i++;
   }
   System.out.println(" --------------------------------");
 }
Ejemplo n.º 6
0
 /**
  * Print all the rules in this list to System.out, and include information about the lift measure.
  *
  * @param databaseSize the number of transactions in the transaction database where the rules were
  *     found
  */
 public void printRulesWithLift(int objectsCount) {
   System.out.println(" ------- " + name + " -------");
   int i = 0;
   for (Rule rule : rules) {
     System.out.print("  rule " + i + ":  " + rule.toString());
     System.out.print(
         "support :  "
             + rule.getRelativeSupport(objectsCount)
             + " ("
             + rule.getAbsoluteSupport()
             + "/"
             + objectsCount
             + ") ");
     System.out.print("confidence :  " + rule.getConfidence());
     System.out.print(" lift :  " + rule.getLift());
     System.out.println("");
     i++;
   }
   System.out.println(" --------------------------------");
 }