Examples of insertAttributeAt()


Examples of weka.core.Instances.insertAttributeAt()

    if ((m_Insert.getIndex() < 0) ||
  (m_Insert.getIndex() > getInputFormat().numAttributes())) {
      throw new IllegalArgumentException("Index out of range");
    }
    outputFormat.insertAttributeAt(newAttribute, m_Insert.getIndex());
    setOutputFormat(outputFormat);
   
    // all attributes, except index of added attribute
    // (otherwise the length of the input/output indices differ)
    Range atts = new Range(m_Insert.getSingleIndex());
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()

    Attribute classAttribute = (Attribute) instanceInfo.classAttribute().copy();
    Attribute bagIndex = (Attribute) instanceInfo.attribute(0).copy();

    /* create a new output format (propositional instance format) */
    Instances newData = instanceInfo.attribute(1).relation().stringFreeStructure();
    newData.insertAttributeAt(bagIndex, 0);
    newData.insertAttributeAt(classAttribute, newData.numAttributes());
    newData.setClassIndex(newData.numAttributes() - 1);

    super.setOutputFormat(newData.stringFreeStructure());

View Full Code Here

Examples of weka.core.Instances.insertAttributeAt()

    Attribute bagIndex = (Attribute) instanceInfo.attribute(0).copy();

    /* create a new output format (propositional instance format) */
    Instances newData = instanceInfo.attribute(1).relation().stringFreeStructure();
    newData.insertAttributeAt(bagIndex, 0);
    newData.insertAttributeAt(classAttribute, newData.numAttributes());
    newData.setClassIndex(newData.numAttributes() - 1);

    super.setOutputFormat(newData.stringFreeStructure());

    m_BagStringAtts = new StringLocator(instanceInfo.attribute(1).relation().stringFreeStructure());
View Full Code Here

Examples of weka.core.Instances.insertAttributeAt()

    double labelValue;

    Instances newData = train.attribute(1).relation().stringFreeStructure();

    //insert a bag label attribute at the begining
    newData.insertAttributeAt(bagLabel, 0);

    //insert a class attribute at the end
    newData.insertAttributeAt(classAttribute, newData.numAttributes());
    newData.setClassIndex(newData.numAttributes()-1);
View Full Code Here

Examples of weka.core.Instances.insertAttributeAt()

    //insert a bag label attribute at the begining
    newData.insertAttributeAt(bagLabel, 0);

    //insert a class attribute at the end
    newData.insertAttributeAt(classAttribute, newData.numAttributes());
    newData.setClassIndex(newData.numAttributes()-1);

    Instances mini_data = newData.stringFreeStructure();
    Instances max_data = newData.stringFreeStructure();
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 (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(),
             outputFormat.numAttributes());
      outputFormat.renameAttribute(outputFormat.numAttributes() - 1,
           "Copy of " + origAttribute.name());

    }
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.