本文整理汇总了Java中ca.pfv.spmf.algorithms.frequentpatterns.zart.TFTableFrequent类的典型用法代码示例。如果您正苦于以下问题:Java TFTableFrequent类的具体用法?Java TFTableFrequent怎么用?Java TFTableFrequent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TFTableFrequent类属于ca.pfv.spmf.algorithms.frequentpatterns.zart包,在下文中一共展示了TFTableFrequent类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import ca.pfv.spmf.algorithms.frequentpatterns.zart.TFTableFrequent; //导入依赖的package包/类
@Test
public void main() {
NoExceptionAssertion.assertDoesNotThrow(() -> {
String input = "contextZart.txt"; // the database
String output = ".//output.txt"; // the path for saving the frequent itemsets found
// Load a binary context
TransactionDatabase context = new TransactionDatabase();
context.loadFile(input);
// Apply the Zart algorithm
double minsup = 0.4;
AlgoZart zart = new AlgoZart();
TZTableClosed results = zart.runAlgorithm(context, minsup);
TFTableFrequent frequents = zart.getTableFrequent();
zart.printStatistics();
zart.saveResultsToFile(output);
});
}
示例2: main
import ca.pfv.spmf.algorithms.frequentpatterns.zart.TFTableFrequent; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
String input = fileToPath("contextZart.txt"); // the database
String output = "C://patterns//zart_output.txt"; // the path for saving the frequent itemsets found
// Load a binary context
TransactionDatabase context = new TransactionDatabase();
context.loadFile(input);
// Apply the Zart algorithm
double minsup = 0.4;
AlgoZart zart = new AlgoZart();
TZTableClosed results = zart.runAlgorithm(context, minsup);
TFTableFrequent frequents = zart.getTableFrequent();
zart.printStatistics();
zart.saveResultsToFile(output);
}
示例3: main
import ca.pfv.spmf.algorithms.frequentpatterns.zart.TFTableFrequent; //导入依赖的package包/类
@Test
public void main() {
NoExceptionAssertion.assertDoesNotThrow(() -> {
// Load a binary context
TransactionDatabase context = new TransactionDatabase();
context.loadFile("contextZart.txt");
// Apply the Zart algorithm
double minsup = 0.4;
AlgoZart zart = new AlgoZart();
TZTableClosed results = zart.runAlgorithm(context, minsup);
TFTableFrequent frequents = zart.getTableFrequent();
zart.printStatistics();
// PRINTING RESULTS
int countClosed = 0;
int countGenerators = 0;
System.out.println("======= List of closed itemsets and their generators ============");
for (int i = 0; i < results.levels.size(); i++) {
System.out.println("LEVEL (SIZE) : " + i);
for (Itemset closed : results.levels.get(i)) {
System.out.println(" CLOSED : \n " + closed.toString() + " supp : " + closed.getAbsoluteSupport());
countClosed++;
System.out.println(" GENERATORS : ");
List<Itemset> generators = results.mapGenerators.get(closed);
// if there are some generators
if (generators.size() != 0) {
for (Itemset generator : generators) {
countGenerators++;
System.out.println(" =" + generator.toString());
}
} else {
// otherwise the closed itemset is a generator
countGenerators++;
System.out.println(" =" + closed.toString());
}
}
}
System.out.println(" NUMBER OF CLOSED : " + countClosed + " NUMBER OF GENERATORS : " + countGenerators);
// SECOND, WE PRINT THE LIST OF ALL FREQUENT ITEMSETS
System.out.println("======= List of all frequent itemsets ============");
int countFrequent = 0;
for (int i = 0; i < frequents.levels.size(); i++) {
System.out.println("LEVEL (SIZE) : " + i);
for (Itemset itemset : frequents.levels.get(i)) {
countFrequent++;
System.out.println(" ITEMSET : " + itemset.toString() + " supp : " + itemset.getAbsoluteSupport());
}
}
System.out.println("NB OF FREQUENT ITEMSETS : " + countFrequent);
});
}
示例4: main
import ca.pfv.spmf.algorithms.frequentpatterns.zart.TFTableFrequent; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
// Load a binary context
TransactionDatabase context = new TransactionDatabase();
context.loadFile(fileToPath("contextZart.txt"));
// Apply the Zart algorithm
double minsup = 0.4;
AlgoZart zart = new AlgoZart();
TZTableClosed results = zart.runAlgorithm(context, minsup);
TFTableFrequent frequents = zart.getTableFrequent();
zart.printStatistics();
// PRINTING RESULTS
int countClosed=0;
int countGenerators=0;
System.out.println("======= List of closed itemsets and their generators ============");
for(int i=0; i< results.levels.size(); i++){
System.out.println("LEVEL (SIZE) : " + i);
for(Itemset closed : results.levels.get(i)){
System.out.println(" CLOSED : " + closed.toString() + " supp : " + closed.getAbsoluteSupport());
countClosed++;
System.out.println(" GENERATORS : ");
for(Itemset generator : results.mapGenerators.get(closed)){
countGenerators++;
System.out.println(" =" + generator.toString());
}
}
}
System.out.println(" NUMBER OF CLOSED : " + countClosed + " NUMBER OF GENERATORS : " + countGenerators );
// SECOND, WE PRINT THE LIST OF ALL FREQUENT ITEMSETS
System.out.println("======= List of all frequent itemsets ============");
int countFrequent =0;
for(int i=0; i< frequents.levels.size(); i++){
System.out.println("LEVEL (SIZE) : " + i);
for(Itemset itemset : frequents.levels.get(i)){
countFrequent++;
System.out.println(" ITEMSET : " + itemset.toString() + " supp : " + itemset.getAbsoluteSupport());
}
}
System.out.println("NB OF FREQUENT ITEMSETS : " + countFrequent);
}