List of usage examples for weka.associations ItemSet upDateCounter
public void upDateCounter(Instance instance)
From source file:cba.RuleItem.java
License:Open Source License
/** * Constructs a new RuleItem if the support of the given rule is above the support threshold. * @param premise the premise//from ww w .j a v a2 s.com * @param consequence the consequence * @param instances the instances * @param genTime the time of generation of the current premise and consequence * @param minRuleCount the support threshold * @param m_midPoints the mid points of the intervals * @param m_priors the estimated priori probabilities (in a hashtable) * @return a RuleItem if its support is above the threshold, null otherwise */ public RuleItem generateRuleItem(ItemSet premise, ItemSet consequence, Instances instances, int genTime, int minRuleCount, double[] m_midPoints, Hashtable m_priors) { ItemSet rule = new ItemSet(instances.numInstances()); rule.m_items = new int[(consequence.m_items).length]; System.arraycopy(premise.m_items, 0, rule.m_items, 0, (premise.m_items).length); for (int k = 0; k < consequence.m_items.length; k++) { if (consequence.m_items[k] != -1) rule.m_items[k] = consequence.m_items[k]; } for (int i = 0; i < instances.numInstances(); i++) rule.upDateCounter(instances.instance(i)); int ruleSupport = rule.support(); if (ruleSupport > minRuleCount) { RuleItem newRule = new RuleItem(premise, consequence, genTime, ruleSupport, m_midPoints, m_priors); return newRule; } return null; }