Package weka.core

Examples of weka.core.Instances.classIndex()


    buff.append(PMMLUtils.pad("Predictor", " ", (maxParamWidth + (maxAttWidth * 2 + 2))
                              - "Predictor".length(), true));
    buff.append("\n" + PMMLUtils.pad("Parameter", " ", maxParamWidth - "Parameter".length(), false));
    // attribute names
    for (int i = 0; i < miningSchemaI.numAttributes(); i++) {
      if (i != miningSchemaI.classIndex()) {
        String attName = miningSchemaI.attribute(i).name();
        buff.append(PMMLUtils.pad(attName, " ", maxAttWidth + 1 - attName.length(), true));
      }
    }
    buff.append("\n");
View Full Code Here


        ? param.m_label
        : param.m_name;
      buff.append(PMMLUtils.pad(paramS, " ",
                                maxParamWidth - paramS.length(), false));
      for (int j = 0; j < miningSchemaI.numAttributes(); j++) {
        if (j != miningSchemaI.classIndex()) {
          PPCell p = m_ppMatrix[i][j];
          String val = " ";
          if (p != null) {
            if (miningSchemaI.attribute(j).isNominal() ||
                miningSchemaI.attribute(j).isString()) {
View Full Code Here

      Instances input = getInputFormat();
      m_Means = new double[input.numAttributes()];
      m_StdDevs = new double[input.numAttributes()];
      for (int i = 0; i < input.numAttributes(); i++) {
  if (input.attribute(i).isNumeric() &&
      (input.classIndex() != i)) {
    m_Means[i] = input.meanOrMode(i);
    m_StdDevs[i] = Math.sqrt(input.variance(i));
  }
      }
View Full Code Here

    if (j == 0) {
      pd1.setPlotName(Messages.getInstance().getString("Plot2D_Main_Pd1_SetPlotName_Text_First"));
      p2.setMasterPlot(pd1);
      p2.setXindex(2);
      p2.setYindex(3);
      p2.setCindex(i.classIndex());
    } else {
      pd1.setPlotName(Messages.getInstance().getString("Plot2D_Main_Pd1_SetPlotName_Text_Second") + (j+1));
      pd1.m_useCustomColour = true;
      pd1.m_customColour = (j % 2 == 0) ? Color.red : Color.blue;
      p2.addPlot(pd1);
View Full Code Here

   
    m_tView.setHighlight(m_top.m_identity);
    m_iView = new VisualizePanel(this);
    //m_iView.setSize(400, 300);
    m_iView.setInstances(m_top.m_training);
    m_iView.setColourIndex(te.classIndex());
    //vis_frame = new JFrame();
    //vis_frame.getContentPane().add(m_iView);
    //vis_frame.setSize(400, 300);
    //vis_frame.setVisible(true);
    m_reps.add("Data Visualizer", m_iView);
View Full Code Here

            + "incoming instances!");
      }
    }

    // check class attribute (if set)
   if (fieldsI.classIndex() >= 0) {
      if (dataSet.classIndex() < 0) {
  // first see if we can find a matching class
  String className = fieldsI.classAttribute().name();
  Attribute classMatch = dataSet.attribute(className);
  if (classMatch == null) {
View Full Code Here

      throw new Exception("Filter must not alter the number of "
                          +"attributes in the data!");
    }

    // Check the class index (if set)
    if (original.classIndex() >= 0) {
      if (data.classIndex() != original.classIndex()) {
        throw new Exception("Filter must not change the class attribute!");
      }
    }
View Full Code Here

                          +"attributes in the data!");
    }

    // Check the class index (if set)
    if (original.classIndex() >= 0) {
      if (data.classIndex() != original.classIndex()) {
        throw new Exception("Filter must not change the class attribute!");
      }
    }

    // check the order
View Full Code Here

      Instances toFilter = getInputFormat();
      int[] attsToDelete = new int[toFilter.numAttributes()];
      int numToDelete = 0;
      for(int i = 0; i < toFilter.numAttributes(); i++) {
  if (i==toFilter.classIndex()) continue; // skip class
  AttributeStats stats = toFilter.attributeStats(i);
  if (stats.missingCount == toFilter.numInstances()) {
          attsToDelete[numToDelete++] = i;
        } else if (stats.distinctCount < 2) {
    // remove constant attributes
View Full Code Here

    // 1. Initialize to {} a set of tuples t containing potential tests
    ArrayList t = new ArrayList();

    // go through each attribute
    for(int a = 0; a < n.numAttributes(); a++) {
       if(a == n.classIndex())
          continue;   // skip the class

       // sort instances in atbop by $a
       int [] sorted = sortByAttribute(n, a);
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.