Package weka.core

Examples of weka.core.FastVector.elementAt()


      for (int i=0; i<numClassifiers; i++) {
  RemoveWithValues classFilter = new RemoveWithValues();
  classFilter.setAttributeIndex("" + (insts.classIndex() + 1));
  classFilter.setModifyHeader(true);
  classFilter.setInvertSelection(true);
  classFilter.setNominalIndicesArr((int[])pairs.elementAt(i));
  Instances tempInstances = new Instances(insts, 0);
  tempInstances.setClassIndex(-1);
  classFilter.setInputFormat(tempInstances);
  newInsts = Filter.useFilter(insts, classFilter);
  if (newInsts.numInstances() > 0) {
View Full Code Here


    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

    NodeList nodelist = doc.getElementsByTagName("DEFINITION");
    for (int iNode = 0; iNode < nodelist.getLength(); iNode++) {
      Node node = nodelist.item(iNode);
      FastVector list = selectElements(node, "FOR");
      if (list.size() > 0) {
        Node forNode = (Node) list.elementAt(0);
        if (getContent((Element) forNode).trim().equals(sName)) {
          return (Element) node;
        }
      }
    }
View Full Code Here

      // Get the name of the network
      nodelist2 = selectElements(nodelist.item(iNode), "NAME");
      if (nodelist2.size() == 0) {
        throw new Exception("No name specified for variable");
      }
      String sBaseName = ((CharacterData) (((Node) nodelist2.elementAt(0)).getFirstChild())).getData();
      sBaseNames.addElement(sBaseName);
      String sNodeName = sBaseName;
      if (getNode2(sNodeName) >= 0) {
        sNodeName = "Copy of " + sBaseName;
      }
View Full Code Here

      // get the parents for this node
      // resolve structure
      nodelist2 = selectElements(definition, "GIVEN");
      for (int iParent = 0; iParent < nodelist2.size(); iParent++) {
        Node parentName = ((Node) nodelist2.elementAt(iParent)).getFirstChild();
        String sParentName = ((CharacterData) (parentName)).getData();
        int nParent = -1;
        for (int iBase = 0; iBase < sBaseNames.size(); iBase++) {
          if (sParentName.equals((String) sBaseNames.elementAt(iBase))) {
            nParent = nBase + iBase;
View Full Code Here

        + " negative instances");

    // Sort phrases according to their distance (stable sort)
    double[] vals = new double[vector.size()];
    for (int i = 0; i < vals.length; i++) {
      vals[i] = ((Instance) vector.elementAt(i)).value(distAttIndex);
    }
    FastVector newVector = new FastVector(vector.size());
    int[] sortedIndices = Utils.stableSort(vals);
    for (int i = 0; i < vals.length; i++) {
      newVector.addElement(vector.elementAt(sortedIndices[i]));
View Full Code Here

      if(m_Debug)
        System.err.println("\nNew rule found: "+
         newRule.toString(m_Class));
    }
    else{
      RipperRule oldRule = (RipperRule)ruleset.elementAt(position);
      boolean covers = false;
      // Test coverage of the next old rule
      for(int i=0; i<newData.numInstances(); i++)
        if(oldRule.covers(newData.instance(i))){
    covers = true;
View Full Code Here

    for(int j=0; j<m_RulesetStats.size(); j++){
      RuleStats rs = (RuleStats)m_RulesetStats.elementAt(j);
      FastVector rules = rs.getRuleset();
      for(int k=0; k<rules.size(); k++){
  double[] simStats = rs.getSimpleStats(k);
  sb.append(((RipperRule)rules.elementAt(k)).toString(m_Class)
      + " ("+simStats[0]+"/"+simStats[4]+")\n");
      }         
    }
    if(m_Debug){
      System.err.println("Inside m_Ruleset");
View Full Code Here

      m_nominalAttIndices[i] = ((Integer)nominalIndices.elementAt(i)).intValue();
   
    // create numeric array
    m_numericAttIndices = new int[numericIndices.size()];
    for (int i=0; i<numericIndices.size(); i++)
      m_numericAttIndices[i] = ((Integer)numericIndices.elementAt(i)).intValue();
  }

  /**
   * Performs a search for the best test (splitter) to add to the tree, by aiming to
   * minimize the Z value.
View Full Code Here

  private void goDownRandomPathSingle(PredictionNode currentNode,
              Instances posInstances, Instances negInstances)
    throws Exception {

    FastVector children = currentNode.getChildren();
    Splitter split = (Splitter) children.elementAt(getRandom(children.size()));
    int branch = getRandom(split.getNumOfBranches());
    searchForBestTestSingle(split.getChildForBranch(branch),
          split.instancesDownBranch(branch, posInstances),
          split.instancesDownBranch(branch, negInstances));
  }
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.