Example usage for weka.associations LabeledItemSet generateRules

List of usage examples for weka.associations LabeledItemSet generateRules

Introduction

In this page you can find the example usage for weka.associations LabeledItemSet generateRules.

Prototype

public final ArrayList<Object>[] generateRules(double minConfidence, boolean noPrune) 

Source Link

Document

Generates rules out of item sets

Usage

From source file:cba.Apriori.java

License:Open Source License

/** 
 * Method that finds all class association rules.
 *
 * @throws Exception if an attribute is numeric
 *//* w w w .  j a v a2s.c o m*/
private void findCarRulesQuickly() throws Exception {

    FastVector[] rules;

    // Build rules
    for (int j = 0; j < m_Ls.size(); j++) {
        FastVector currentLabeledItemSets = (FastVector) m_Ls.elementAt(j);
        Enumeration enumLabeledItemSets = currentLabeledItemSets.elements();
        while (enumLabeledItemSets.hasMoreElements()) {
            LabeledItemSet currentLabeledItemSet = (LabeledItemSet) enumLabeledItemSets.nextElement();
            rules = currentLabeledItemSet.generateRules(m_minMetric, false);
            for (int k = 0; k < rules[0].size(); k++) {
                m_allTheRules[0].addElement(rules[0].elementAt(k));
                m_allTheRules[1].addElement(rules[1].elementAt(k));
                m_allTheRules[2].addElement(rules[2].elementAt(k));
            }
        }
    }
}