Example usage for weka.associations AprioriItemSet generateRulesBruteForce

List of usage examples for weka.associations AprioriItemSet generateRulesBruteForce

Introduction

In this page you can find the example usage for weka.associations AprioriItemSet generateRulesBruteForce.

Prototype

public final ArrayList<Object>[] generateRulesBruteForce(double minMetric, int metricType,
        ArrayList<Hashtable<ItemSet, Integer>> hashtables, int numItemsInSet, int numTransactions,
        double significanceLevel) throws Exception 

Source Link

Document

Generates all significant rules for an item set.

Usage

From source file:cba.Apriori.java

License:Open Source License

/** 
 * Method that finds all association rules and performs significance test.
 *
 * @throws Exception if an attribute is numeric
 *//* w  w  w  .  j a  va  2  s. co m*/
private void findRulesBruteForce() throws Exception {

    FastVector[] rules;

    // Build rules
    for (int j = 1; j < m_Ls.size(); j++) {
        FastVector currentItemSets = (FastVector) m_Ls.elementAt(j);
        Enumeration enumItemSets = currentItemSets.elements();
        while (enumItemSets.hasMoreElements()) {
            AprioriItemSet currentItemSet = (AprioriItemSet) enumItemSets.nextElement();
            //AprioriItemSet currentItemSet = new AprioriItemSet((ItemSet)enumItemSets.nextElement());
            rules = currentItemSet.generateRulesBruteForce(m_minMetric, m_metricType, m_hashtables, j + 1,
                    m_instances.numInstances(), m_significanceLevel);
            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));

                m_allTheRules[3].addElement(rules[3].elementAt(k));
                m_allTheRules[4].addElement(rules[4].elementAt(k));
                m_allTheRules[5].addElement(rules[5].elementAt(k));
            }
        }
    }
}