Examples of FastVector


Examples of weka.core.FastVector

            : m_minSupport;
    }

    do {
      // Reserve space for variables
      m_Ls = new FastVector();
      m_hashtables = new FastVector();
      m_allTheRules = new FastVector[6];
      m_allTheRules[0] = new FastVector();
      m_allTheRules[1] = new FastVector();
      m_allTheRules[2] = new FastVector();
      //if (m_metricType != CONFIDENCE || m_significanceLevel != -1) {
  m_allTheRules[3] = new FastVector();
  m_allTheRules[4] = new FastVector();
  m_allTheRules[5] = new FastVector();
     // }
      sortedRuleSet = new FastVector[6];
      sortedRuleSet[0] = new FastVector();
      sortedRuleSet[1] = new FastVector();
      sortedRuleSet[2] = new FastVector();
      //if (m_metricType != CONFIDENCE || m_significanceLevel != -1) {
  sortedRuleSet[3] = new FastVector();
  sortedRuleSet[4] = new FastVector();
  sortedRuleSet[5] = new FastVector();
      //}
      if(!m_car){
        // Find large itemsets and rules
        findLargeItemSets();
        if (m_significanceLevel != -1 || m_metricType != CONFIDENCE)
View Full Code Here

Examples of weka.core.FastVector

  private void pruneRulesForUpperBoundSupport() {
    int necMaxSupport = (int)(m_upperBoundMinSupport * (double)m_instances.numInstances()+0.5);
   
    FastVector[] prunedRules = new FastVector[6];
    for (int i = 0; i < 6; i++) {
      prunedRules[i] = new FastVector();
    }
   
    for (int i = 0; i < m_allTheRules[0].size(); i++) {
      if (((ItemSet)m_allTheRules[1].elementAt(i)).support() <= necMaxSupport) {
        prunedRules[0].addElement(m_allTheRules[0].elementAt(i));
View Full Code Here

Examples of weka.core.FastVector

      +"confidence)",
      stringZeroAsMissing = "\tTreat zero (i.e. first value of nominal attributes) as " +
          "missing";
   

    FastVector newVector = new FastVector(11);

    newVector.addElement(new Option(string1, "N", 1,
            "-N <required number of rules output>"));
    newVector.addElement(new Option(stringType, "T", 1,
            "-T <0=confidence | 1=lift | "
            +"2=leverage | 3=Conviction>"));
    newVector.addElement(new Option(string2, "C", 1,
            "-C <minimum metric score of a rule>"));
    newVector.addElement(new Option(string3 + string4, "D", 1,
            "-D <delta for minimum support>"));
    newVector.addElement(new Option("\tUpper bound for minimum support. "
            +"(default = 1.0)", "U", 1,
             "-U <upper bound for minimum support>"));
    newVector.addElement(new Option(string5, "M", 1,
            "-M <lower bound for minimum support>"));
    newVector.addElement(new Option(string6 + string7, "S", 1,
            "-S <significance level>"));
    newVector.addElement(new Option(string8, "I", 0,
            "-I"));
    newVector.addElement(new Option("\tRemove columns that contain "
            +"all missing values (default = no)"
            , "R", 0,
            "-R"));
    newVector.addElement(new Option("\tReport progress iteratively. (default "
            +"= no)", "V", 0,
            "-V"));
    newVector.addElement(new Option(string9, "A", 0,
            "-A"));
    newVector.addElement(new Option(stringZeroAsMissing, "Z", 0,
        "-Z"));
    newVector.addElement(new Option(string10, "c", 1,
            "-c <the class index>"));
   
    return newVector.elements();
  }
View Full Code Here

Examples of weka.core.FastVector

   *
   * @throws Exception if an attribute is numeric
   */
  private void findLargeItemSets() throws Exception {
   
    FastVector kMinusOneSets, kSets;
    Hashtable hashtable;
    int necSupport, necMaxSupport,i = 0;
   
   
   
    // Find large itemsets

    // minimum support
    necSupport = (int)(m_minSupport * (double)m_instances.numInstances()+0.5);
    necMaxSupport = (int)(m_upperBoundMinSupport * (double)m_instances.numInstances()+0.5);
  
    kSets = AprioriItemSet.singletons(m_instances, m_treatZeroAsMissing);
    AprioriItemSet.upDateCounters(kSets,m_instances);
    kSets = AprioriItemSet.deleteItemSets(kSets, necSupport, m_instances.numInstances());
    if (kSets.size() == 0)
      return;
    do {
      m_Ls.addElement(kSets);
      kMinusOneSets = kSets;
      kSets = AprioriItemSet.mergeAllItemSets(kMinusOneSets, i, m_instances.numInstances());
      hashtable = AprioriItemSet.getHashtable(kMinusOneSets, kMinusOneSets.size());
      m_hashtables.addElement(hashtable);
      kSets = AprioriItemSet.pruneItemSets(kSets, hashtable);
      AprioriItemSet.upDateCounters(kSets, m_instances);
      kSets = AprioriItemSet.deleteItemSets(kSets, necSupport, m_instances.numInstances());
      i++;
View Full Code Here

Examples of weka.core.FastVector

    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,
View Full Code Here

Examples of weka.core.FastVector

  private void findRulesQuickly() 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.generateRules(m_minMetric, m_hashtables, j + 1);
  for (int k = 0; k < rules[0].size(); k++) {
View Full Code Here

Examples of weka.core.FastVector

     * Method that finds all large itemsets for class association rules for the given set of instances.
     * @throws Exception if an attribute is numeric
     */
    private void findLargeCarItemSets() throws Exception {
 
  FastVector kMinusOneSets, kSets;
  Hashtable hashtable;
  int necSupport, necMaxSupport,i = 0;
 
  // Find large itemsets
 
  // minimum support
        double nextMinSupport = m_minSupport*(double)m_instances.numInstances();
        double nextMaxSupport = m_upperBoundMinSupport*(double)m_instances.numInstances();
  if((double)Math.rint(nextMinSupport) == nextMinSupport){
            necSupport = (int) nextMinSupport;
        }
        else{
            necSupport = Math.round((float)(nextMinSupport+0.5));
        }
        if((double)Math.rint(nextMaxSupport) == nextMaxSupport){
            necMaxSupport = (int) nextMaxSupport;
        }
        else{
            necMaxSupport = Math.round((float)(nextMaxSupport+0.5));
        }
 
  //find item sets of length one
  kSets = LabeledItemSet.singletons(m_instances,m_onlyClass);
  LabeledItemSet.upDateCounters(kSets, m_instances,m_onlyClass);
       
        //check if a item set of lentgh one is frequent, if not delete it
  kSets = LabeledItemSet.deleteItemSets(kSets, necSupport, m_instances.numInstances());
        if (kSets.size() == 0)
      return;
  do {
      m_Ls.addElement(kSets);
      kMinusOneSets = kSets;
      kSets = LabeledItemSet.mergeAllItemSets(kMinusOneSets, i, m_instances.numInstances());
      hashtable = LabeledItemSet.getHashtable(kMinusOneSets, kMinusOneSets.size());
      kSets = LabeledItemSet.pruneItemSets(kSets, hashtable);
      LabeledItemSet.upDateCounters(kSets, m_instances,m_onlyClass);
      kSets = LabeledItemSet.deleteItemSets(kSets, necSupport, m_instances.numInstances());
      i++;
  } while (kSets.size() > 0);
View Full Code Here

Examples of weka.core.FastVector

    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));
View Full Code Here

Examples of weka.core.FastVector

        } catch (Exception ex) {
    System.err.println(ex);
        }
        plotInstances.cleanUp();

        FastVector vv = new FastVector();
        vv.addElement(fullClusterer);
        Instances trainHeader = new Instances(m_Instances, 0);
        vv.addElement(trainHeader);
        if (ignoredAtts != null) vv.addElement(ignoredAtts);
        if (saveVis) {
    vv.addElement(m_CurrentVis);
    if (grph != null) {
      vv.addElement(grph);
    }
   
        }
        m_History.addObject(name, vv);
      }
View Full Code Here

Examples of weka.core.FastVector

    loadClusterer();
  }
      });
    resultListMenu.add(loadModel);

    FastVector o = null;
    if (selectedName != null) {
      o = (FastVector)m_History.getNamedObject(selectedName);
    }

    VisualizePanel temp_vp = null;
    String temp_grph = null;
    Clusterer temp_clusterer = null;
    Instances temp_trainHeader = null;
    int[] temp_ignoreAtts = null;
   
    if (o != null) {
      for (int i = 0; i < o.size(); i++) {
  Object temp = o.elementAt(i);
  if (temp instanceof Clusterer) {
    temp_clusterer = (Clusterer)temp;
  } else if (temp instanceof Instances) { // training header
    temp_trainHeader = (Instances)temp;
  } else if (temp instanceof int[]) { // ignored attributes
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.