Examples of Instance


Examples of weka.core.Instance

      initTokenizer();

      readHeader(1000);
      initBuffers();
     
      Instance inst;
      while ((inst = readInstance(m_Data)) != null) {
        m_Data.add(inst);
      };
     
      compactify();
View Full Code Here

Examples of weka.core.Instance

     * @see      #getData()
     */
    public ArffReader(Reader reader, Instances template, int lines) throws IOException {
      this(reader, template, lines, 100);

      Instance inst;
      while ((inst = readInstance(m_Data)) != null) {
        m_Data.add(inst);
      };

      compactify();
View Full Code Here

Examples of weka.core.Instance

      // Add instance to dataset
      double[] tempValues = new double[numValues];
      int[] tempIndices = new int[numValues];
      System.arraycopy(m_ValueBuffer, 0, tempValues, 0, numValues);
      System.arraycopy(m_IndicesBuffer, 0, tempIndices, 0, numValues);
      Instance inst = new SparseInstance(weight, tempValues, tempIndices, m_Data.numAttributes());
      inst.setDataset(m_Data);
     
      return inst;
    }
View Full Code Here

Examples of weka.core.Instance

          weight = 1.0;
        }
      }
       
      // Add instance to dataset
      Instance inst = new DenseInstance(weight, instance);
      inst.setDataset(m_Data);
     
      return inst;
    }
View Full Code Here

Examples of weka.core.Instance

     
      Instances cBCurve = m_costBenefit.getPlotInstances();
      int maxMinIndex = 0;
     
      for (int i = 0; i < cBCurve.numInstances(); i++) {
        Instance current = cBCurve.instance(i);
        if (max) {
          if (current.value(1) > maxMin) {
            maxMin = current.value(1);
            maxMinIndex = i;
          }
        } else {
          if (current.value(1) < maxMin) {
            maxMin = current.value(1);
            maxMinIndex = i;
          }
        }
      }
     
View Full Code Here

Examples of weka.core.Instance

      double CB = m_costBenefit.
        getPlotInstances().instance(index).value(1);
      m_costBenefitV.setText(Utils.doubleToString(CB,2));
     
      double totalRandomCB = 0.0;
      Instance first = m_masterPlot.getPlotInstances().instance(0);
      double totalPos = first.value(m_masterPlot.getPlotInstances().
          attribute(ThresholdCurve.TRUE_POS_NAME).index()) * scaleFactor;
      double totalNeg = first.value(m_masterPlot.getPlotInstances().
          attribute(ThresholdCurve.FALSE_POS_NAME)) * scaleFactor;

      double posInSample = (totalPos * (Double.parseDouble(m_percPopLab.getText()) / 100.0));
      double negInSample = (totalNeg * (Double.parseDouble(m_percPopLab.getText()) / 100.0));
      double posOutSample = totalPos - posInSample;
      double negOutSample = totalNeg - negInSample;
     
      double tpCost = 0.0;
      try {
        tpCost = Double.parseDouble(m_cost_aa.getText());
      } catch (NumberFormatException n) {}
      double fpCost = 0.0;
      try {
        fpCost = Double.parseDouble(m_cost_ba.getText());
      } catch (NumberFormatException n) {}
      double tnCost = 0.0;
      try {
        tnCost = Double.parseDouble(m_cost_bb.getText());
      } catch (NumberFormatException n) {}
      double fnCost = 0.0;
      try {
        fnCost = Double.parseDouble(m_cost_ab.getText());
      } catch (NumberFormatException n) {}
           
      totalRandomCB += posInSample * tpCost;
      totalRandomCB += negInSample * fpCost;
      totalRandomCB += posOutSample * fnCost;
      totalRandomCB += negOutSample * tnCost;
     
      m_randomV.setText(Utils.doubleToString(totalRandomCB, 2));
      double gain = (m_costR.isSelected())
      ? totalRandomCB - CB
          : CB - totalRandomCB;
      m_gainV.setText(Utils.doubleToString(gain, 2));
     
      // update classification rate
      Instance currentInst = m_masterPlot.getPlotInstances().instance(index);
      double tp = currentInst.value(m_masterPlot.getPlotInstances().
          attribute(ThresholdCurve.TRUE_POS_NAME).index());
      double tn = currentInst.value(m_masterPlot.getPlotInstances().
          attribute(ThresholdCurve.TRUE_NEG_NAME).index());
      m_classificationAccV.
        setText(Utils.doubleToString((tp + tn) / (totalPos + totalNeg) * 100.0, 4) + "%");     
    }
View Full Code Here

Examples of weka.core.Instance

//      double totalInstances =
      int tp = plotInstances.attribute(ThresholdCurve.TRUE_POS_NAME).index();
      int fp = plotInstances.attribute(ThresholdCurve.FALSE_POS_NAME).index();
      int tn = plotInstances.attribute(ThresholdCurve.TRUE_NEG_NAME).index();
      int fn = plotInstances.attribute(ThresholdCurve.FALSE_NEG_NAME).index();
      Instance temp = plotInstances.instance(index);
      double totalInstances = temp.value(tp) + temp.value(fp) + temp.value(tn) + temp.value(fn);
      // get the value out of the total pop field (if possible)
      double requestedPopSize = totalInstances;
      try {
        requestedPopSize = Double.parseDouble(m_totalPopField.getText());
      } catch (NumberFormatException e) {}
     
      m_conf_aa.setCellValue(temp.value(tp), totalInstances,
          requestedPopSize / totalInstances, 2);
      m_conf_ab.setCellValue(temp.value(fn), totalInstances,
          requestedPopSize / totalInstances, 2);
      m_conf_ba.setCellValue(temp.value(fp), totalInstances,
          requestedPopSize / totalInstances, 2);
      m_conf_bb.setCellValue(temp.value(tn), totalInstances,
            requestedPopSize / totalInstances, 2);
     
      updateCBRandomGainInfo(index);
     
      repaint();
View Full Code Here

Examples of weka.core.Instance

      m_tnPrevious = 0;
      m_fnPrevious = 0;
      m_previousShapeIndex = -1;

      // set the total population size
      Instance first = m_masterPlot.getPlotInstances().instance(0);
      double totalPos = first.value(m_masterPlot.getPlotInstances().
          attribute(ThresholdCurve.TRUE_POS_NAME).index());
      double totalNeg = first.value(m_masterPlot.getPlotInstances().
          attribute(ThresholdCurve.FALSE_POS_NAME));
      m_originalPopSize = (int)(totalPos + totalNeg);
      m_totalPopField.setText("" + m_originalPopSize);

      m_performancePanel.setYIndex(5);
View Full Code Here

Examples of weka.core.Instance

     
      // process the performance data to make this curve
      Instances performanceI = m_masterPlot.getPlotInstances();
     
      for (int i = 0; i < performanceI.numInstances(); i++) {
        Instance current = performanceI.instance(i);
       
        double[] vals = new double[2];
        vals[0] = current.value(10); // sample size
        vals[1] = (current.value(0) * tpCost
            + current.value(1) * fnCost
            + current.value(2) * fpCost
            + current.value(3) * tnCost) * scaleFactor;
        Instance newInst = new DenseInstance(1.0, vals);
        costBenefitI.add(newInst);
      }
     
      costBenefitI.compactify();
     
View Full Code Here

Examples of zz.jinterp.JClass_java_lang_Class.Instance

  }
 
  public Instance getMetaclass(JType aType)
  {
    checkInit();
    Instance theInstance = itsLoadedMetaclasses.get(aType);
    if (theInstance == null)
    {
      theInstance = new Instance(itsMetaclassClass, aType);
      itsLoadedMetaclasses.put(aType, theInstance);
    }
    return theInstance;
  }
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.