Package weka.core

Examples of weka.core.Instances.numInstances()


    inst.setValue(attrA,0);inst.setValue(attrB, 1);inst.setValue(attrC, 1);inst.setValue(attrClass, 0);
    Assert.assertEquals(4,trainingData.numAttributes());
    Assert.assertEquals(0,trainingData.numInstances());
    trainingData.add(inst);
    Assert.assertEquals(4,trainingData.numAttributes());
    Assert.assertEquals(1,trainingData.numInstances());
  }
 
  @Test
  public void testConstructTooBig1()
  {
View Full Code Here


    DataSource source;
    try
    {
      source = new DataSource(arffFileName);
      Instances instances = source.getDataSet();
      logger.debug("Number of instances in arff file is " + instances.numInstances());
     
      Enumeration enu = instances.enumerateInstances();
      //get all the feedback lines
     
      while(enu.hasMoreElements())
View Full Code Here

    DataSource source;
    try
    {
      source = new DataSource(arffFileName);
      Instances instances = source.getDataSet();
      logger.debug("Number of instances in arff file is " + instances.numInstances());
     
      Enumeration enu = instances.enumerateInstances();
      //get all the feedback lines
     
      while(enu.hasMoreElements())
View Full Code Here

    try
    {
      source = new DataSource(arffFileName);
      Instances instances = source.getDataSet();
      feedbacks = new ArrayList<Feedback>();
      logger.debug("Number of instances in arff file is " + instances.numInstances());
     
      Enumeration enu = instances.enumerateInstances();
      //get all the feedback lines
     
      while(enu.hasMoreElements())
View Full Code Here

      if (!m_instances.instance(noa).classIsMissing()) {
  totalWeight += m_instances.instance(noa).weight();
      }
    }
    if (m_valSize != 0) {
      for (int noa = 0; noa < valSet.numInstances(); noa++) {
  if (!valSet.instance(noa).classIsMissing()) {
    totalValWeight += valSet.instance(noa).weight();
  }
      }
    }
View Full Code Here

      }

      ////////////////////////do validation testing if applicable
      if (m_valSize != 0) {
  right = 0;
  for (int nob = 0; nob < valSet.numInstances(); nob++) {
    m_currentInstance = valSet.instance(nob);
    if (!m_currentInstance.classIsMissing()) {
      //this is where the network updating occurs, for the validation set
      resetNetwork();
      calculateOutputs();
View Full Code Here

      Instances data = new Instances(insts, insts.numInstances());
      for(int i = 0; i < insts.numInstances(); i++){
        if(insts.instance(i).weight() > 0)
          data.add(insts.instance(i));
      }
      if (data.numInstances() == 0) {
        throw new Exception("No training instances left after removing " +
        "instances with weight 0!");
      }
      insts = data;
    }
View Full Code Here

                  BinarySMO smo = (BinarySMO)so.getObject(); */
          BinarySMO smo = new BinarySMO();
          smo.setKernel(Kernel.makeCopy(SMO.this.m_kernel));
          smo.buildClassifier(train, cl1, cl2, false, -1, -1);
    Instances test = insts.testCV(numFolds, i);
    for (int j = 0; j < test.numInstances(); j++) {
      double[] vals = new double[2];
      vals[0] = smo.SVMOutput(-1, test.instance(j));
      if (test.instance(j).classValue() == cl2) {
        vals[1] = 1;
      }
View Full Code Here

      if (instances.instance(i).weight() > 0) {
  data.add(instances.instance(i));
      }
    }
   
    if (data.numInstances() == 0) {
      throw new Exception("No training instances left after removing " + "instance with either a weight null or a missing class!");
    }
    instances = data;
   
    m_onlyNumeric = true;
View Full Code Here

          : Double.POSITIVE_INFINITY;
     
      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;
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.