Package weka.core

Examples of weka.core.Attribute.numValues()


  attIndex = 0;
  while (enumAtts.hasMoreElements()) {
    Attribute attribute = (Attribute) enumAtts.nextElement();
    text.append("Attribute " + attribute.name() + "\n");
    if (attribute.isNominal()) {
      for (int j = 0; j < attribute.numValues(); j++) {
        text.append(attribute.value(j) + "\t");
      }
      text.append("\n");
      for (int j = 0; j < attribute.numValues(); j++)
        text.append(Utils.
View Full Code Here


    if (attribute.isNominal()) {
      for (int j = 0; j < attribute.numValues(); j++) {
        text.append(attribute.value(j) + "\t");
      }
      text.append("\n");
      for (int j = 0; j < attribute.numValues(); j++)
        text.append(Utils.
        doubleToString(m_Counts[i][attIndex][j], 10, 8)
        + "\t");
    } else {
      text.append("Mean: " + Utils.
View Full Code Here

      if (m_functionType == CLASSIFICATION) {
        // target category MUST be defined
        String targetCat = table.getAttribute("targetCategory");
        if (targetCat.length() > 0) {
          Attribute classA = miningSchema.classAttribute();
          for (int i = 0; i < classA.numValues(); i++) {
            if (classA.value(i).equals(targetCat)) {
              m_targetCategory = i;
            }
          }
        }
View Full Code Here

    Attribute predictedClass;

    Attribute classAt = trainInstances.attribute(trainInstances.classIndex());
    if (classAt.isNominal()) {
      FastVector attVals = new FastVector();
      for (int i = 0; i < classAt.numValues(); i++) {
  attVals.addElement(classAt.value(i));
      }
      predictedClass = new Attribute(Messages.getInstance().getString("ClassifierPanel_SetUpVisualizableInstances_PredictedClass_Attribute_Text_First") + classAt.name(), attVals);
    } else {
      predictedClass = new Attribute(Messages.getInstance().getString("ClassifierPanel_SetUpVisualizableInstances_PredictedClass_Attribute_Text_Second") + classAt.name());
View Full Code Here

    }
    resultListMenu.add(visMargin);

    JMenu visThreshold = new JMenu(Messages.getInstance().getString("ClassifierPanel_Visualize_VisThreshold_JMenu_Text"));
    if (preds != null && classAtt != null) {
      for (int i = 0; i < classAtt.numValues(); i++) {
  JMenuItem clv = new JMenuItem(classAtt.value(i));
  final int classValue = i;
  clv.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        try {
View Full Code Here

    }
    resultListMenu.add(visThreshold);
   
    JMenu visCostBenefit = new JMenu(Messages.getInstance().getString("ClassifierPanel_Visualize_VisCostBenefit_JMenu_Text"));
    if ((preds != null) && (classAtt != null) && (classAtt.isNominal())) {
      for (int i = 0; i < classAtt.numValues(); i++) {
        JMenuItem clv = new JMenuItem(classAtt.value(i));
        final int classValue = i;
        clv.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              try {
View Full Code Here

   
    // allocate space for the matrix
    m_paramMatrix =
        new PCell[(classAtt.isNumeric())
                  ? 1
                  : classAtt.numValues()][m_parameterList.size()];

    NodeList pcellL = matrix.getElementsByTagName("PCell");
    for (int i = 0; i < pcellL.getLength(); i++) {
      // indicates that that this beta applies to all target categories
      // or target is numeric
View Full Code Here

  newAtts.addElement(att.copy());
      } else {
   
  // Compute list of attribute values
   
  newVals = new FastVector(att.numValues());
  for (int i = 0; i < att.numValues(); i++) {
    if (i == m_FirstIndex.getIndex()) {
      newVals.addElement(att.value(m_SecondIndex.getIndex()));
    } else if (i == m_SecondIndex.getIndex()) {
      newVals.addElement(att.value(m_FirstIndex.getIndex()));
View Full Code Here

      } else {
   
  // Compute list of attribute values
   
  newVals = new FastVector(att.numValues());
  for (int i = 0; i < att.numValues(); i++) {
    if (i == m_FirstIndex.getIndex()) {
      newVals.addElement(att.value(m_SecondIndex.getIndex()));
    } else if (i == m_SecondIndex.getIndex()) {
      newVals.addElement(att.value(m_FirstIndex.getIndex()));
    } else {
View Full Code Here

      Attribute att = getInputFormat().attribute(j);
      if (!att.isNominal() || (j == getInputFormat().classIndex()) ||
    !m_Columns.isInRange(j)) {
  newAtts.addElement(att.copy());
      } else {
  if ( (att.numValues() <= 2) && (!m_TransformAll) ) {
    if (m_Numeric) {
      newAtts.addElement(new Attribute(att.name()));
    } else {
      newAtts.addElement(att.copy());
    }
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.