Package weka.core

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


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

        //Add the new columns. There is one for each unigram and each bigram.
        for (int i = 0; i < unigrams.size(); i++) {
            String name = "uni_" + unigrams.get(i);
            Attribute attr = new Attribute(name);
            outputFormat.insertAttributeAt(attr, outputFormat.numAttributes());
        }

        for (int i = 0; i < bigrams.size(); i++) {
            String name = "bi_" + bigrams.get(i);
            Attribute attr = new Attribute(name);
View Full Code Here

        }

        for (int i = 0; i < bigrams.size(); i++) {
            String name = "bi_" + bigrams.get(i);
            Attribute attr = new Attribute(name);
            outputFormat.insertAttributeAt(attr, outputFormat.numAttributes());
        }

        return outputFormat;
    }
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.