当前位置: 首页>>代码示例>>Java>>正文


Java AlgoZart类代码示例

本文整理汇总了Java中ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart的典型用法代码示例。如果您正苦于以下问题:Java AlgoZart类的具体用法?Java AlgoZart怎么用?Java AlgoZart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AlgoZart类属于ca.pfv.spmf.algorithms.frequentpatterns.zart包,在下文中一共展示了AlgoZart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runAlgorithm

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的package包/类
@Override
public void runAlgorithm(String[] parameters, String inputFile, String outputFile) throws IOException {

	System.out.println("STEP 1: APPLY ZART TO FIND CLOSED ITEMSETS AND GENERATORS");
	double minsup = getParamAsDouble(parameters[0]);
	double minconf = getParamAsDouble(parameters[1]);
	TransactionDatabase database = new TransactionDatabase();
	try {
		database.loadFile(inputFile);
	} catch (Exception e) {
		e.printStackTrace();
	}
	
	// Applying the Zart algorithm
	AlgoZart zart = new AlgoZart();
	TZTableClosed results = zart.runAlgorithm(database, minsup);
	zart.printStatistics();
	
	System.out.println("STEP 2 : CALCULATING MNR ASSOCIATION RULES");
	// Run the algorithm to generate MNR rules
	AlgoMNRRules algoMNR = new AlgoMNRRules();
	algoMNR.runAlgorithm(outputFile, minconf, results, database.size());
	algoMNR.printStatistics();
}
 
开发者ID:matfax,项目名称:spmf,代码行数:25,代码来源:DescriptionAlgoMNRAssociationRules.java

示例2: runAlgorithm

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的package包/类
@Override
public void runAlgorithm(String[] parameters, String inputFile, String outputFile) throws IOException {
	double minsup = getParamAsDouble(parameters[0]);
	double minconf = getParamAsDouble(parameters[1]);

	TransactionDatabase database = new TransactionDatabase();
	try {
		database.loadFile(inputFile);
	} catch (Exception e) {
		e.printStackTrace();
	}

	// Applying the Zart algorithm
	AlgoZart zart = new AlgoZart();
	TZTableClosed results = zart.runAlgorithm(database, minsup);
	zart.printStatistics();
	// Generate IGB association rules
	AlgoIGB algoIGB = new AlgoIGB();
	algoIGB.runAlgorithm(results, database.getTransactions().size(),
			minconf, outputFile);
	algoIGB.printStatistics();
}
 
开发者ID:matfax,项目名称:spmf,代码行数:23,代码来源:DescriptionAlgoIGBAssociationRules.java

示例3: main

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的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);

    });
}
 
开发者ID:matfax,项目名称:spmf,代码行数:22,代码来源:MainTestZart_saveToFile.java

示例4: main

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
	System.out.println("STEP 1 : EXECUTING THE ZART ALGORITHM TO FIND CLOSED ITEMSETS AND MINIMUM GENERATORS");
	String input = fileToPath("contextIGB.txt");
	String output = "C:\\patterns\\IGB_association_rules.txt";
	
	TransactionDatabase database = new TransactionDatabase();
	try {
		database.loadFile(input);
	} catch (Exception e) {
		e.printStackTrace();
	}
	
	// Applying the Zart algorithm
	AlgoZart zart = new AlgoZart();
	double minsup = 0.5;
	TZTableClosed results = zart.runAlgorithm(database, minsup);
	zart.printStatistics();
	
	System.out.println("STEP 2 : RUNNING THE IGB ALGORITHM");
	// Apply the IGB algorithm
	double minconf = 0.61; // minimum confidence
	AlgoIGB algoIGB = new AlgoIGB();
	algoIGB.runAlgorithm(results, database.getTransactions().size(), minconf, output);
	algoIGB.printStatistics();
}
 
开发者ID:YinYanfei,项目名称:CadalWorkspace,代码行数:26,代码来源:MainTestIGB_saveToFile.java

示例5: main

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的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);
			
	}
 
开发者ID:YinYanfei,项目名称:CadalWorkspace,代码行数:19,代码来源:MainTestZart_saveToFile.java

示例6: runAlgorithm

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的package包/类
@Override
public void runAlgorithm(String[] parameters, String inputFile, String outputFile) throws IOException {
	double minsup = getParamAsDouble(parameters[0]);

	// Load a binary context
	TransactionDatabase context = new TransactionDatabase();
	context.loadFile(inputFile);

	// Apply the Zart algorithm
	AlgoZart zart = new AlgoZart();
	zart.runAlgorithm(context, minsup);
	zart.printStatistics();
	zart.saveResultsToFile(outputFile);
}
 
开发者ID:matfax,项目名称:spmf,代码行数:15,代码来源:DescriptionAlgoZart.java

示例7: main

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的package包/类
@Test
public void main() {
    NoExceptionAssertion.assertDoesNotThrow(() -> {
        System.out.println("STEP 1 : EXECUTING THE ZART ALGORITHM TO FIND CLOSED ITEMSETS AND MINIMUM GENERATORS");
        String input = "contextIGB.txt";
        String output = ".//output.txt";

        TransactionDatabase database = new TransactionDatabase();
        try {
            database.loadFile(input);
        } catch (Exception e) {
            e.printStackTrace();
        }

        // Applying the Zart algorithm
        AlgoZart zart = new AlgoZart();
        double minsup = 0.5;
        TZTableClosed results = zart.runAlgorithm(database, minsup);
        zart.printStatistics();

        System.out.println("STEP 2 : RUNNING THE IGB ALGORITHM");
        // Apply the IGB algorithm
        double minconf = 0.61; // minimum confidence
        AlgoIGB algoIGB = new AlgoIGB();
        algoIGB.runAlgorithm(results, database.getTransactions().size(), minconf, output);
        algoIGB.printStatistics();
    });
}
 
开发者ID:matfax,项目名称:spmf,代码行数:29,代码来源:MainTestIGB_saveToFile.java

示例8: main

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的package包/类
@Test
public void main() {
    NoExceptionAssertion.assertDoesNotThrow(() -> {
        System.out.println("STEP 1 : EXECUTING THE ZART ALGORITHM TO FIND CLOSED ITEMSETS AND MINIMUM GENERATORS");
        String input = "contextIGB.txt";
        String output = null;
        // Note : we set the output to null because we choose to keep
        // the result into memory instead of saving to a file, for this
        // example.

        TransactionDatabase database = new TransactionDatabase();
        try {
            database.loadFile(input);
        } catch (Exception e) {
            e.printStackTrace();
        }

        // Applying the Zart algorithm
        AlgoZart zart = new AlgoZart();
        double minsup = 0.5;
        TZTableClosed results = zart.runAlgorithm(database, minsup);
        zart.printStatistics();

        System.out.println("STEP 2 : RUNNING THE IGB ALGORITHM");
        // Apply the IGB algorithm
        double minconf = 0.61; // minimum confidence
        AlgoIGB algoIGB = new AlgoIGB();
        Rules rules = algoIGB.runAlgorithm(results, database.getTransactions().size(), minconf, output);
        algoIGB.printStatistics();
        rules.printRules(database.getTransactions().size());
    });
}
 
开发者ID:matfax,项目名称:spmf,代码行数:33,代码来源:MainTestIGB_saveToMemory.java

示例9: main

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
	System.out.println("STEP 1 : EXECUTING THE ZART ALGORITHM TO FIND CLOSED ITEMSETS AND MINIMUM GENERATORS");
	String input = fileToPath("contextIGB.txt");
	String output = null;
	// Note : we set the output to null because we choose to keep 
	// the result into memory instead of saving to a file, for this
	// example.
	
	TransactionDatabase database = new TransactionDatabase();
	try {
		database.loadFile(input);
	} catch (Exception e) {
		e.printStackTrace();
	}
	
	// Applying the Zart algorithm
	AlgoZart zart = new AlgoZart();
	double minsup = 0.5;
	TZTableClosed results = zart.runAlgorithm(database, minsup);
	zart.printStatistics();
	
	System.out.println("STEP 2 : RUNNING THE IGB ALGORITHM");
	// Apply the IGB algorithm
	double minconf = 0.61; // minimum confidence
	AlgoIGB algoIGB = new AlgoIGB();
	Rules rules = algoIGB.runAlgorithm(results, database.getTransactions().size(), minconf,output);
	algoIGB.printStatistics();
	rules.printRules(database.getTransactions().size());
}
 
开发者ID:YinYanfei,项目名称:CadalWorkspace,代码行数:30,代码来源:MainTestIGB_saveToMemory.java

示例10: main

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的package包/类
@Test
    public void main() {
        NoExceptionAssertion.assertDoesNotThrow(() -> {

            System.out.println("STEP 1 :  FIND CLOSED ITEMSETS AND MINIMUM GENERATORS By EXECUTING THE ZART ALGORITHM");
            String input = "contextZart.txt";
            String output = ".//output.txt";
//		
            double minsup = 0.6;  // minimum support
            double minconf = 0.6; // minimum confidence

            TransactionDatabase database = new TransactionDatabase();
            try {
                database.loadFile(input);
            } catch (Exception e) {
                e.printStackTrace();
            }
            database.printDatabase();

            // Applying the Zart algorithm
            AlgoZart zart = new AlgoZart();
            TZTableClosed results = zart.runAlgorithm(database, minsup);
            //zart.printStatistics();

            // PRINT RESULTS FROM THE ZART ALGORITHM
//		int countClosed=0;
//		int countGenerators=0;
//		System.out.println("===================");
//		for(int i=0; i< results.levels.size(); i++){
//			System.out.println("LEVEL : " + i);
//			for(Itemset closed : results.levels.get(i)){
//				System.out.println(" CLOSED : " + 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("STEP 2 :Extract Rules from closed item set and associated generators by using MNR Rules ");

            // Run the algorithm to generate MNR rules
            AlgoMNRRules algoMNR = new AlgoMNRRules();
            Rules rules = algoMNR.runAlgorithm(null, minconf, results, database.size());
            algoMNR.printStatistics();

            // Print each rule found
            for (Rule rule : rules.getRules()) {
                System.out.println(rule + " SUP: " + rule.getAbsoluteSupport() + " CONF: " + rule.getConfidence());
            }
        });
    }
 
开发者ID:matfax,项目名称:spmf,代码行数:63,代码来源:MainTestMNRRules_saveToMemory.java

示例11: main

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的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);

    });
}
 
开发者ID:matfax,项目名称:spmf,代码行数:57,代码来源:MainTestZart_saveToMemory.java

示例12: main

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的package包/类
@Test
    public void main() {
        NoExceptionAssertion.assertDoesNotThrow(() -> {

            System.out.println("STEP 1 : EXECUTING THE ZART ALGORITHM TO FIND CLOSED ITEMSETS AND MINIMUM GENERATORS");
            String input = "contextZart.txt";
            String output = ".//output.txt";
//		
            double minsup = 0.6;  // minimum support
            double minconf = 0.6; // minimum confidence

            TransactionDatabase database = new TransactionDatabase();
            try {
                database.loadFile(input);
            } catch (Exception e) {
                e.printStackTrace();
            }
            database.printDatabase();

            // Applying the Zart algorithm
            AlgoZart zart = new AlgoZart();
            TZTableClosed results = zart.runAlgorithm(database, minsup);
            zart.printStatistics();

//		// PRINT RESULTS FROM THE ZART ALGORITHM
//		int countClosed=0;
//		int countGenerators=0;
//		System.out.println("===================");
//		for(int i=0; i< results.levels.size(); i++){
//			System.out.println("LEVEL : " + 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("STEP 2 : CALCULATING MNR ASSOCIATION RULES");
            // Run the algorithm to generate MNR rules
            AlgoMNRRules algoMNR = new AlgoMNRRules();
            algoMNR.runAlgorithm(output, minconf, results, database.size());
        });
    }
 
开发者ID:matfax,项目名称:spmf,代码行数:48,代码来源:MainTestMNRRules_saveToFile.java

示例13: main

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的package包/类
public static void main(String[] args) throws IOException {

		System.out.println("STEP 1 : EXECUTING THE ZART ALGORITHM TO FIND CLOSED ITEMSETS AND MINIMUM GENERATORS");
		String input = fileToPath("contextZart.txt");
		String output = null;
		// Note, above, we set the output file path to null
		// because we want to keep the result into memory for this example

		double minsup = 0.6;  // minimum support
		double minconf = 0.6; // minimum confidence
		
		TransactionDatabase database = new TransactionDatabase();
		try {
			database.loadFile(input);
		} catch (Exception e) {
			e.printStackTrace();
		}
		database.printDatabase();
		
		// Applying the Zart algorithm
		AlgoZart zart = new AlgoZart();
		TZTableClosed results = zart.runAlgorithm(database, minsup);
		zart.printStatistics();
		
//		// PRINT RESULTS FROM THE ZART ALGORITHM
//		int countClosed=0;
//		int countGenerators=0;
//		System.out.println("===================");
//		for(int i=0; i< results.levels.size(); i++){
//			System.out.println("LEVEL : " + 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("STEP 2 : CALCULATING MNR ASSOCIATION RULES");
		// Create MNR rules.
		AlgoMNRRules algoMNR = new AlgoMNRRules();
		Rules rules = 	algoMNR.runAlgorithm(output, minconf, results, database.size());
		rules.printRules(database.size());
	}
 
开发者ID:YinYanfei,项目名称:CadalWorkspace,代码行数:48,代码来源:MainTestMNRRules_saveToMemory.java

示例14: main

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的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);
		
	}
 
开发者ID:YinYanfei,项目名称:CadalWorkspace,代码行数:45,代码来源:MainTestZart_saveToMemory.java

示例15: main

import ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart; //导入依赖的package包/类
public static void main(String[] args) throws IOException {

		System.out.println("STEP 1 : EXECUTING THE ZART ALGORITHM TO FIND CLOSED ITEMSETS AND MINIMUM GENERATORS");
		String input = fileToPath("contextZart.txt");
		String output = "C:\\patterns\\MNR_association_rules.txt";
//		
		double minsup = 0.6;  // minimum support
		double minconf = 0.6; // minimum confidence
		
		TransactionDatabase database = new TransactionDatabase();
		try {
			database.loadFile(input);
		} catch (Exception e) {
			e.printStackTrace();
		}
		database.printDatabase();
		
		// Applying the Zart algorithm
		AlgoZart zart = new AlgoZart();
		TZTableClosed results = zart.runAlgorithm(database, minsup);
		zart.printStatistics();
		
//		// PRINT RESULTS FROM THE ZART ALGORITHM
//		int countClosed=0;
//		int countGenerators=0;
//		System.out.println("===================");
//		for(int i=0; i< results.levels.size(); i++){
//			System.out.println("LEVEL : " + 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("STEP 2 : CALCULATING MNR ASSOCIATION RULES");
		// Run the algorithm to generate MNR rules
		AlgoMNRRules algoMNR = new AlgoMNRRules();
		algoMNR.runAlgorithm(output, minconf, results, database.size());
	}
 
开发者ID:YinYanfei,项目名称:CadalWorkspace,代码行数:45,代码来源:MainTestMNRRules_saveToFile.java


注:本文中的ca.pfv.spmf.algorithms.frequentpatterns.zart.AlgoZart类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。