Example usage for weka.associations FPGrowth getAssociationRules

List of usage examples for weka.associations FPGrowth getAssociationRules

Introduction

In this page you can find the example usage for weka.associations FPGrowth getAssociationRules.

Prototype

@Override
public AssociationRules getAssociationRules() 

Source Link

Document

Gets the list of mined association rules.

Usage

From source file:fiit.gpminerstatic.Main.java

public static void main(String args[]) {
    ArrayList<Attribute> attributes = new ArrayList<Attribute>();
    for (int i = 0; i < 1000; i++) {
        attributes.add(new Attribute(String.valueOf(i)));
    }/*from  ww  w . j av  a 2 s . c  o m*/
    // load data from file into instances 
    SessionsFileStream stream = new SessionsFileStream(
            "g:\\workspace_GPMiner\\data\\alef_sessions_aggregated.csv");
    Instances instances = new Instances("Instances", attributes, 1000);
    Enumeration<Instance> enumer = instances.enumerateInstances();
    while (enumer.hasMoreElements()) {
        instances.add(enumer.nextElement());
    }
    try {
        // make global patterns with fpgrowth alghoritm 
        FPGrowth fp = new FPGrowth();
        fp.buildAssociations(instances);
        AssociationRules assocRules = fp.getAssociationRules();
    } catch (Exception ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:rdfsystem.data.DataMining.java

public static String assoiate(RdfManager manager) throws Exception {
    Instances ins = transformData(manager, false);

    FPGrowth ass = new FPGrowth();
    String[] options = "-T 0 -C 0.5 -M 0.1".split(" ");
    ass.setOptions(options);//from w ww.  j a v  a2s .c  om
    ass.buildAssociations(ins);
    List<AssociationRule> res = ass.getAssociationRules();
    for (AssociationRule rule : res)
        System.out.println(rule);

    return null;
}