Package weka.core

Examples of weka.core.Attribute.copy()


    atts = new ArrayList<Attribute>();
    for (i = 0; i < inputFormat.numAttributes(); i++) {
      att = inputFormat.attribute(i);
      if (m_AttributeIndices.isInRange(i)) {
  if (m_ReplaceAll)
    atts.add(att.copy(att.name().replaceAll(m_Find, m_Replace)));
  else
    atts.add(att.copy(att.name().replaceFirst(m_Find, m_Replace)));
      }
      else {
  atts.add((Attribute) att.copy());
View Full Code Here


      att = inputFormat.attribute(i);
      if (m_AttributeIndices.isInRange(i)) {
  if (m_ReplaceAll)
    atts.add(att.copy(att.name().replaceAll(m_Find, m_Replace)));
  else
    atts.add(att.copy(att.name().replaceFirst(m_Find, m_Replace)));
      }
      else {
  atts.add((Attribute) att.copy());
      }
    }
View Full Code Here

    atts.add(att.copy(att.name().replaceAll(m_Find, m_Replace)));
  else
    atts.add(att.copy(att.name().replaceFirst(m_Find, m_Replace)));
      }
      else {
  atts.add((Attribute) att.copy());
      }
    }
    result = new Instances(inputFormat.relationName(), atts, 0);
    result.setClassIndex(inputFormat.classIndex());
   
View Full Code Here

      // add unused attributes
      if (!getRemoveUnused()) {
  for (i = 0; i < m_IndicesUnused.length; i++) {
    att = inputFormat.attribute(m_IndicesUnused[i]);
    atts.add(att.copy("unfiltered-" + att.name()));
  }
      }

      // add class if present
      if (inputFormat.classIndex() > -1)
View Full Code Here

    newAtts = new FastVector();
    for (int j = 0; j < getInputFormat().numAttributes(); j++) {
      Attribute att = getInputFormat().attribute(j);
      if ((!att.isNominal()) ||
    (j == getInputFormat().classIndex())) {
  newAtts.addElement(att.copy());
      } else {
  if ( (att.numValues() <= 2) && (!m_TransformAll) ) {
    if (m_Numeric) {
      newAtts.addElement(new Attribute(att.name()));
    } else {
View Full Code Here

      } else {
  if ( (att.numValues() <= 2) && (!m_TransformAll) ) {
    if (m_Numeric) {
      newAtts.addElement(new Attribute(att.name()));
    } else {
      newAtts.addElement(att.copy());
    }
  } else {

    if (j < getInputFormat().classIndex()) {
      newClassIndex += att.numValues() - 1;
View Full Code Here

    newAtts = new FastVector();
    for (int j = 0; j < getInputFormat().numAttributes(); j++) {
      Attribute att = getInputFormat().attribute(j);
      if ((!att.isNominal()) ||
    (j == getInputFormat().classIndex())) {
  newAtts.addElement(att.copy());
      } else {
  if (j < getInputFormat().classIndex())
    newClassIndex += att.numValues() - 2;
   
  // Compute values for new attributes
View Full Code Here

     
    newAtts = new FastVector(getInputFormat().numAttributes());
    for (int j = 0; j < getInputFormat().numAttributes(); j++) {
      Attribute att = getInputFormat().attribute(j);
      if (j != m_AttIndex.getIndex()) {
  newAtts.addElement(att.copy());
      } else {
   
  // Compute new value
   
  if (att.value(m_FirstIndex.getIndex()).endsWith("'")) {
View Full Code Here

      } else {
  if ( (att.numValues() <= 2) && (!m_TransformAll) ) {
    if (m_Numeric) {
      newAtts.addElement(new Attribute(att.name()));
    } else {
      newAtts.addElement(att.copy());
    }
  } else {

    if (newClassIndex >= 0 && j < getInputFormat().classIndex()) {
      newClassIndex += att.numValues() - 1;
View Full Code Here

      // add unused attributes
      if (!getRemoveUnused()) {
  for (i = 0; i < m_IndicesUnused.length; i++) {
    att = inputFormat.attribute(m_IndicesUnused[i]);
    atts.addElement(att.copy("unfiltered-" + att.name()));
  }
      }

      // add class if present
      if (inputFormat.classIndex() > -1)
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.