Examples of insertAttributeAt()


Examples of weka.core.Instances.insertAttributeAt()

        sNodeName = "Copy (" + iAttempt + ") of " + sBaseName;
        iAttempt++;
      }

      Attribute att = new Attribute(sNodeName, nomStrings);
      instances.insertAttributeAt(att, instances.numAttributes());

      valueslist = selectElements(nodelist.item(iNode), "PROPERTY");
      nValues = valueslist.size();
      // generate value strings
      int nPosX = iAttempt * 10;
 
View Full Code Here

Examples of weka.core.Instances.insertAttributeAt()

     
      // Temporarily unset the class index
      int classIndex = data.classIndex();
      boostData.setClassIndex(-1);
      boostData.deleteAttributeAt(classIndex);
      boostData.insertAttributeAt(new Attribute("'pseudo class'"), classIndex);
      boostData.setClassIndex(classIndex);
      double [][] trainFs = new double [numInstances][m_NumClasses];
      double [][] trainYs = new double [numInstances][m_NumClasses];
      for (int j = 0; j < m_NumClasses; j++) {
  for (int i = 0, k = 0; i < numInstances; i++, k++) {
View Full Code Here

Examples of weka.core.Instances.insertAttributeAt()

    boostData = new Instances(data);

    // Temporarily unset the class index
    boostData.setClassIndex(-1);
    boostData.deleteAttributeAt(classIndex);
    boostData.insertAttributeAt(new Attribute("'pseudo class'"), classIndex);
    boostData.setClassIndex(classIndex);
    m_NumericClassData = new Instances(boostData, 0);

    data.randomize(m_RandomInstance);
View Full Code Here

Examples of weka.core.Instances.insertAttributeAt()

   
    // Make class numeric
    Instances trainN = new Instances(train);
    trainN.setClassIndex(-1);
    trainN.deleteAttributeAt(classIndex);
    trainN.insertAttributeAt(new Attribute("'pseudo class'"), classIndex);
    trainN.setClassIndex(classIndex);
    m_NumericClassData = new Instances(trainN, 0);
   
    // Get class values
    int numInstances = train.numInstances();
View Full Code Here

Examples of weka.core.Instances.insertAttributeAt()

    /* Create a binary attribute */
    FastVector binary_values = new FastVector(2);
    binary_values.addElement("otherClasses");
    binary_values.addElement("defClass");
    Attribute attr = new Attribute ("newClass", binary_values);
    data.insertAttributeAt(attr, index)
    data.setClassIndex(index);                 // The new class label

    /* Partition the data into bags according to their original class values */
    Instances[] dataByClass = new Instances[numCl];
    for(int i=0; i < numCl; i++)
View Full Code Here

Examples of weka.core.Instances.insertAttributeAt()

        sNodeName = "Copy (" + iAttempt + ") of " + sBaseName;
        iAttempt++;
      }

      Attribute att = new Attribute(sNodeName, nomStrings);
      instances.insertAttributeAt(att, instances.numAttributes());

      valueslist = selectElements(nodelist.item(iNode), "PROPERTY");
      nValues = valueslist.size();
      // generate value strings
      int nPosX = iAttempt * 10;
 
View Full Code Here

Examples of weka.core.Instances.insertAttributeAt()

    if ((m_Index.getIndex() < 0) ||
        (m_Index.getIndex() > getInputFormat().numAttributes()))
      throw new IllegalArgumentException("Index out of range");
   
    outputFormat.insertAttributeAt(newAttribute, m_Index.getIndex());
    setOutputFormat(outputFormat);
   
    return true;
  }
View Full Code Here

Examples of weka.core.Instances.insertAttributeAt()

  if (isLast)
    index = result.numAttributes() - 1;
  else
    index = result.numAttributes();
 
  result.insertAttributeAt(
      new Attribute(prefix + "_padding_" + (i+1)),
      index);
 
  // record index
  padded.add(new Integer(index));
View Full Code Here

Examples of weka.core.Instances.insertAttributeAt()

      result.add(new Instance(1, newVal));
    }

    // add class again
    if (clsIdx > -1) {
      result.insertAttributeAt(clsAtt, clsIdx);
      result.setClassIndex(clsIdx);
      for (i = 0; i < clsVal.length; i++)
  result.instance(i).setClassValue(clsVal[i]);
    }
   
View Full Code Here

Examples of weka.core.Instances.insertAttributeAt()

    m_SelectedAttributes = m_CopyCols.getSelection();
    for (int i = 0; i < m_SelectedAttributes.length; i++) {
      int current = m_SelectedAttributes[i];
      // Create a copy of the attribute with a different name
      Attribute origAttribute = instanceInfo.attribute(current);
      outputFormat.insertAttributeAt((Attribute)origAttribute.copy("Copy of " + origAttribute.name()),
             outputFormat.numAttributes());
    }

    // adapt locators
    int[] newIndices = new int[instanceInfo.numAttributes() + m_SelectedAttributes.length];
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.