public static void main(String[] arg) throws IOException {
    // Load a sequence database
    SequenceDatabase sequenceDatabase = new SequenceDatabase();
    sequenceDatabase.loadFile(fileToPath("contextPrefixSpan.txt"));
    sequenceDatabase.print();

    int minsup = 2; // we use a minsup of 2 sequences (50 % of the database size)

    AlgoBIDEPlus algo = new AlgoBIDEPlus(); //

    // execute the algorithm
    algo.runAlgorithm(sequenceDatabase, "C://patterns//closed_sequential_patterns.txt", minsup);
    algo.printStatistics(sequenceDatabase.size());
  }
  public static void main(String[] arg) throws IOException {
    String outputPath = ".//output.txt";
    // Load a sequence database
    SequenceDatabase sequenceDatabase = new SequenceDatabase();
    sequenceDatabase.loadFile(fileToPath("contextPrefixSpan.txt"));
    // print the database to console
    sequenceDatabase.print();

    // Create an instance of the algorithm with minsup = 50 %
    AlgoPrefixSpan algo = new AlgoPrefixSpan();

    int minsup = 2; // we use a minimum support of 2 sequences.

    // execute the algorithm
    algo.runAlgorithm(sequenceDatabase, outputPath, minsup);
    algo.printStatistics(sequenceDatabase.size());
  }
Пример #3
0
  public static void main(String[] arg) throws IOException {
    // Load a sequence database
    SequenceDatabase sequenceDatabase = new SequenceDatabase();
    sequenceDatabase.loadFile(fileToPath("contextPrefixSpan.txt"));
    sequenceDatabase.print();
    // Create an instance of the algorithm
    AlgoMaxSP algo = new AlgoMaxSP();

    // if you set the following parameter to true, the sequence ids of the sequences where
    // each pattern appears will be shown in the result
    boolean showSequenceIdentifiers = false;

    // execute the algorithm
    SequentialPatterns patterns = algo.runAlgorithm(sequenceDatabase, null, 2);
    algo.printStatistics(sequenceDatabase.size());
    patterns.printFrequentPatterns(sequenceDatabase.size(), showSequenceIdentifiers);
  }
Пример #4
0
  public static void main(String[] arg) throws IOException {
    // Load a sequence database
    SequenceDatabase sequenceDatabase = new SequenceDatabase();
    sequenceDatabase.loadFile(fileToPath("contextPrefixSpan.txt"));
    //		sequenceDatabase.print();

    int minsup = 2; // we use a minsup of 2 sequences (50 % of the database size)

    AlgoMaxSP algo = new AlgoMaxSP(); //

    // if you set the following parameter to true, the sequence ids of the sequences where
    // each pattern appears will be shown in the result
    algo.setShowSequenceIdentifiers(false);

    // execute the algorithm
    algo.runAlgorithm(sequenceDatabase, ".//output.txt", minsup);
    algo.printStatistics(sequenceDatabase.size());
  }
Пример #5
0
  public static void main(String[] arg) throws IOException {
    // Load a sequence database
    SequenceDatabase sequenceDatabase = new SequenceDatabase();
    sequenceDatabase.loadFile(fileToPath("contextPrefixSpan.txt"));
    // print the database to console
    sequenceDatabase.print();

    // Create an instance of the algorithm
    AlgoFSGP algo = new AlgoFSGP();
    //		algo.setMaximumPatternLength(3);

    // execute the algorithm with minsup = 50 %
    boolean performPruning = true; // to activate pruning of search space
    List<SequentialPattern> patterns = algo.runAlgorithm(sequenceDatabase, 0.5, performPruning);
    algo.printStatistics(sequenceDatabase.size());
    System.out.println(" == PATTERNS ==");
    for (SequentialPattern pattern : patterns) {
      System.out.println(pattern + " support : " + pattern.getAbsoluteSupport());
    }
  }