Examples of classValue()


Examples of weka.core.Instance.classValue()

   
    instance = testClassifier.constructInstance(new int []{-1,0,1,0},false);
    Assert.assertEquals(instance.classValue(), cl.classifyInstance(instance),Configuration.fpAccuracy);
   
    instance = testClassifier.constructInstance(new int []{0,0,1,0},true);
    Assert.assertEquals(instance.classValue(), cl.classifyInstance(instance),Configuration.fpAccuracy);
  }
 
  @Test
  public void TestUniqueIntoState1()
  {
View Full Code Here

Examples of weka.core.Instance.classValue()

      testClassifier.trainingData.add(testClassifier.constructInstance(new int []{-1,-1,1,0},false));
    }
    weka.classifiers.trees.J48 cl = new weka.classifiers.trees.J48();
    cl.buildClassifier(testClassifier.trainingData);
    Instance instance = testClassifier.constructInstance(new int []{1,0,1,0},true);
    Assert.assertEquals(instance.classValue(), cl.classifyInstance(instance),Configuration.fpAccuracy);
   
    instance = testClassifier.constructInstance(new int []{-1,0,1,0},false);
    Assert.assertEquals(instance.classValue(), cl.classifyInstance(instance),Configuration.fpAccuracy);
   
    instance = testClassifier.constructInstance(new int []{0,0,1,0},true);
View Full Code Here

Examples of weka.core.Instance.classValue()

    cl.buildClassifier(testClassifier.trainingData);
    Instance instance = testClassifier.constructInstance(new int []{1,0,1,0},true);
    Assert.assertEquals(instance.classValue(), cl.classifyInstance(instance),Configuration.fpAccuracy);
   
    instance = testClassifier.constructInstance(new int []{-1,0,1,0},false);
    Assert.assertEquals(instance.classValue(), cl.classifyInstance(instance),Configuration.fpAccuracy);
   
    instance = testClassifier.constructInstance(new int []{0,0,1,0},true);
    Assert.assertEquals(instance.classValue(), cl.classifyInstance(instance),Configuration.fpAccuracy);
  }
 
View Full Code Here

Examples of weka.core.Instance.classValue()

      return 1;
    }
    else{
      testInstance(agent);
      //System.out.println("Agent "+agent);
      return agent.classValue();
    }
   
  }
 
  public static void main(String[] args){
View Full Code Here

Examples of weka.core.Instance.classValue()

      for (int i = 0; i < m_TransformedData.numInstances(); i ++) {
  Instance inst = m_TransformedData.instance(i);
  int column = 0;
  for (int j = 0; j < m_TransformedData.numAttributes(); j++) {
    if (j == m_ClassIndex) {
      dependent.setElement(i, 0, inst.classValue());
    } else {
      if (selectedAttributes[j]) {
        double value = inst.value(j) - m_Means[j];
       
        // We only need to do this if we want to
View Full Code Here

Examples of weka.core.Instance.classValue()

          // Set rank to missing (computed below)
          newInst[pos++] = Instance.missingValue();

        } else if (i == keyphrasesAtt) {
          newInst[pos++] = inst.classValue();
        } else {
          newInst[pos++] = instance.value(i);
        }
      }
View Full Code Here

Examples of weka.core.Instance.classValue()

  m_slope = 0;
  for (int j = 0; j < insts.numInstances(); j++) {
    Instance inst = insts.instance(j);
    if (!inst.isMissing(i) && !inst.classIsMissing()) {
      double xDiff = inst.value(i) - xMean;
      double yDiff = inst.classValue() - yMean;
      double weightedXDiff = inst.weight() * xDiff;
      double weightedYDiff = inst.weight() * yDiff;
      m_slope += weightedXDiff * yDiff;
      sumWeightedXDiffSquared += weightedXDiff * xDiff;
      sumWeightedYDiffSquared += weightedYDiff * yDiff;
 
View Full Code Here

Examples of weka.core.Instance.classValue()

      Object x = instanceToArray(inst);
      int m = Array.getLength(x);
      if (m > 0)
        max_index = Math.max(max_index, ((Integer) getField(Array.get(x, m - 1), "index")).intValue());
      vx.add(x);
      double classValue = inst.classValue();
      int classValueInt = (int)classValue;
      if (classValueInt != classValue) throw new RuntimeException("unsupported class value: " + classValue);
      vy.add(Integer.valueOf(classValueInt));
    }
View Full Code Here

Examples of weka.core.Instance.classValue()

    for (int i = 0; i < insts.numClasses(); i++) {
      subsets[i] = new Instances(insts, insts.numInstances());
    }
    for (int j = 0; j < insts.numInstances(); j++) {
      Instance inst = insts.instance(j);
      subsets[(int)inst.classValue()].add(inst);
    }
    for (int i = 0; i < insts.numClasses(); i++) {
      subsets[i].compactify();
    }
View Full Code Here

Examples of weka.core.Instance.classValue()

  // Use training data
  for (int j = 0; j < insts.numInstances(); j++) {
    Instance inst = insts.instance(j);
    double[] vals = new double[2];
    vals[0] = SVMOutput(-1, inst);
    if (inst.classValue() == cl2) {
      vals[1] = 1;
    }
    data.add(new Instance(inst.weight(), vals));
  }
      } else {
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.