本文整理汇总了Java中ca.pfv.spmf.algorithms.frequentpatterns.apriori.AlgoApriori.runAlgorithm方法的典型用法代码示例。如果您正苦于以下问题:Java AlgoApriori.runAlgorithm方法的具体用法?Java AlgoApriori.runAlgorithm怎么用?Java AlgoApriori.runAlgorithm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.pfv.spmf.algorithms.frequentpatterns.apriori.AlgoApriori
的用法示例。
在下文中一共展示了AlgoApriori.runAlgorithm方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例3: 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();
}
示例4: 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();
}