コード例 #1
0
ファイル: PredictiveApriori.java プロジェクト: paolopavan/cfr
  /**
   * Returns an enumeration describing the available options.
   *
   * @return an enumeration of all the available options.
   */
  public Enumeration listOptions() {

    String string1 = "\tThe required number of rules. (default = " + (m_numRules - 5) + ")";
    FastVector newVector = new FastVector(1);

    newVector.addElement(new Option(string1, "N", 1, "-N <required number of rules output>"));
    return newVector.elements();
  }
コード例 #2
0
ファイル: PredictiveApriori.java プロジェクト: paolopavan/cfr
  /**
   * Method that finds all association rules.
   *
   * @exception Exception if an attribute is numeric
   */
  private void findRulesQuickly() throws Exception {

    FastVector[] rules;
    RuleGeneration currentItemSet;

    // Build rules
    for (int j = 0; j < m_Ls.size(); j++) {
      FastVector currentItemSets = (FastVector) m_Ls.elementAt(j);
      Enumeration enumItemSets = currentItemSets.elements();
      while (enumItemSets.hasMoreElements()) {
        currentItemSet = new RuleGeneration((ItemSet) enumItemSets.nextElement());
        m_best =
            currentItemSet.generateRules(
                m_numRules, m_midPoints, m_priors, m_expectation, m_instances, m_best, m_count);

        m_count = currentItemSet.m_count;
        if (!m_bestChanged && currentItemSet.m_change) m_bestChanged = true;
        // update minimum expected predictive accuracy to get into the n best
        if (m_best.size() > 0) m_expectation = ((RuleItem) m_best.first()).accuracy();
        else m_expectation = 0;
      }
    }
  }