本文整理汇总了Java中ca.pfv.spmf.algorithms.frequentpatterns.apriori.AlgoApriori类的典型用法代码示例。如果您正苦于以下问题:Java AlgoApriori类的具体用法?Java AlgoApriori怎么用?Java AlgoApriori使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AlgoApriori类属于ca.pfv.spmf.algorithms.frequentpatterns.apriori包,在下文中一共展示了AlgoApriori类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runAlgorithm
import ca.pfv.spmf.algorithms.frequentpatterns.apriori.AlgoApriori; //导入依赖的package包/类
@Override
public void runAlgorithm(String[] parameters, String inputFile, String outputFile) throws IOException {
double minsup = getParamAsDouble(parameters[0]);
double minconf = getParamAsDouble(parameters[1]);
AlgoApriori apriori = new AlgoApriori();
ca.pfv.spmf.patterns.itemset_array_integers_with_count.Itemsets patterns = apriori
.runAlgorithm(minsup, inputFile, null);
apriori.printStats();
int databaseSize = apriori.getDatabaseSize();
// STEP 2: Generating all rules from the set of frequent itemsets
// (based on Agrawal & Srikant, 94)
ca.pfv.spmf.algorithms.associationrules.agrawal94_association_rules.AlgoAgrawalFaster94 algoAgrawal = new ca.pfv.spmf.algorithms.associationrules.agrawal94_association_rules.AlgoAgrawalFaster94();
algoAgrawal.runAlgorithm(patterns, outputFile, databaseSize,
minconf);
algoAgrawal.printStats();
}
示例2: main
import ca.pfv.spmf.algorithms.frequentpatterns.apriori.AlgoApriori; //导入依赖的package包/类
@Test
public void main() {
NoExceptionAssertion.assertDoesNotThrow(() -> {
String input = "contextPasquier99.txt";
String output = ".//output.txt"; // the path for saving the frequent itemsets found
double minsup = 0.4; // means a minsup of 2 transaction (we used a relative support)
// Applying the Apriori algorithm
AlgoApriori apriori = new AlgoApriori();
apriori.runAlgorithm(minsup, input, output);
apriori.printStats();
});
}
示例3: main
import ca.pfv.spmf.algorithms.frequentpatterns.apriori.AlgoApriori; //导入依赖的package包/类
@Test
public void main() {
NoExceptionAssertion.assertDoesNotThrow(() -> {
String input = "contextPasquier99.txt";
String output = null;
// Note : we here set the output file path to null
// because we want that the algorithm save the
// result in memory for this example.
double minsup = 0.4; // means a minsup of 2 transaction (we used a relative support)
// Applying the Apriori algorithm
AlgoApriori apriori = new AlgoApriori();
Itemsets result = apriori.runAlgorithm(minsup, input, output);
apriori.printStats();
result.printItemsets(apriori.getDatabaseSize());
});
}
示例4: runAlgorithm
import ca.pfv.spmf.algorithms.frequentpatterns.apriori.AlgoApriori; //导入依赖的package包/类
@Override
public void runAlgorithm(String[] parameters, String inputFile, String outputFile) throws IOException {
double minsup = getParamAsDouble(parameters[0]);
// Applying the Apriori algorithm, optimized version
ca.pfv.spmf.algorithms.frequentpatterns.apriori.AlgoApriori apriori = new ca.pfv.spmf.algorithms.frequentpatterns.apriori.AlgoApriori();
apriori.runAlgorithm(minsup, inputFile, outputFile);
apriori.printStats();
}
示例5: mineFrequentItemsetsApriori
import ca.pfv.spmf.algorithms.frequentpatterns.apriori.AlgoApriori; //导入依赖的package包/类
/** Run Apriori algorithm */
public static SortedMap<Itemset, Integer> mineFrequentItemsetsApriori(final String dataset, final String saveFile,
final double minSupp) throws IOException {
// Remove transaction duplicates and sort items ascending
final File TMPDB = File.createTempFile("fixed-dataset", ".dat");
dbTool.convert(dataset, TMPDB.getAbsolutePath());
final AlgoApriori algo = new AlgoApriori();
final Itemsets patterns = algo.runAlgorithm(minSupp, TMPDB.getAbsolutePath(), saveFile);
// algo.printStats();
// patterns.printItemsets(algo.getDatabaseSize());
return toMap(patterns);
}
示例6: main
import ca.pfv.spmf.algorithms.frequentpatterns.apriori.AlgoApriori; //导入依赖的package包/类
public static void main(String [] arg) throws IOException{
// String input = fileToPath("E:/DMTest/contextPasquier99.txt");
String input = "E:/DMTest/contextPasquier99.txt";
String output = "E:/DMTest/Result/frequent_itemsets.txt"; // the path for saving the frequent itemsets found
double minsup = 0.4; // means a minsup of 2 transaction (we used a relative support)
// Applying the Apriori algorithm
AlgoApriori apriori = new AlgoApriori();
apriori.runAlgorithm(minsup, input, output);
apriori.printStats();
}
示例7: main
import ca.pfv.spmf.algorithms.frequentpatterns.apriori.AlgoApriori; //导入依赖的package包/类
public static void main(String [] arg) throws IOException{
String input = fileToPath("contextPasquier99.txt");
String output = "C://patterns//frequent_itemsets.txt"; // the path for saving the frequent itemsets found
double minsup = 0.4; // means a minsup of 2 transaction (we used a relative support)
// Applying the Apriori algorithm
AlgoApriori apriori = new AlgoApriori();
apriori.runAlgorithm(minsup, input, output);
apriori.printStats();
}