Example usage for weka.associations FPGrowth buildAssociations

List of usage examples for weka.associations FPGrowth buildAssociations

Introduction

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

Prototype

@Override
public void buildAssociations(Instances data) throws Exception 

Source Link

Document

Method that generates all large item sets with a minimum support, and from these all association rules with a minimum metric (i.e.

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  w  ww. j ava 2  s .c  om*/
    // 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);//  w  ww.  j a  v  a  2 s .  c om
    ass.buildAssociations(ins);
    List<AssociationRule> res = ass.getAssociationRules();
    for (AssociationRule rule : res)
        System.out.println(rule);

    return null;
}