List of usage examples for weka.associations FPGrowth buildAssociations
@Override public void buildAssociations(Instances data) throws Exception
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; }