Package weka.core

Examples of weka.core.Instance.numAttributes()


    Instances result = useFilter();
    for (int i = 0; i < result.numInstances(); i++) {
      Instance inst = result.instance(i);
      assertEquals("Instance " + (i + 1),
                   Math.cos(inst.value(1) / 5),
                   inst.value(inst.numAttributes() - 1), EXPR_DELTA);
    }
  }

  public void testSin() {
    m_Filter = getFilter("sin(a2/5)");
View Full Code Here


    Instances result = useFilter();
    for (int i = 0; i < result.numInstances(); i++) {
      Instance inst = result.instance(i);
      assertEquals("Instance " + (i + 1),
                   Math.sin(inst.value(1) / 5),
                   inst.value(inst.numAttributes() - 1), EXPR_DELTA);
    }
  }

  public void testTan() {
    m_Filter = getFilter("tan(a2/5)");
View Full Code Here

    Instances result = useFilter();
    for (int i = 0; i < result.numInstances(); i++) {
      Instance inst = result.instance(i);
      assertEquals("Instance " + (i + 1) + ": " + inst + "\n",
                   Math.tan(inst.value(1) / 5),
                   inst.value(inst.numAttributes() - 1), EXPR_DELTA);
    }
  }

  public void testAbs() {
    m_Filter = getFilter("abs(a2-a1)");
View Full Code Here

    Instances result = useFilter();
    for (int i = 0; i < result.numInstances(); i++) {
      Instance inst = result.instance(i);
      assertEquals("Instance " + (i + 1),
                   Math.abs(inst.value(1) - inst.value(0)),
                   inst.value(inst.numAttributes() - 1), EXPR_DELTA);
    }
  }

  public void testExp() {
    m_Filter = getFilter("exp(a2-a1)");
View Full Code Here

    Instances result = useFilter();
    for (int i = 0; i < result.numInstances(); i++) {
      Instance inst = result.instance(i);
      assertEquals("Instance " + (i + 1),
                   Math.exp(inst.value(1) - inst.value(0)),
                   inst.value(inst.numAttributes() - 1), EXPR_DELTA);
    }
  }

  public void testSqrt() {
    m_Filter = getFilter("sqrt(a2+a1/5)");
View Full Code Here

    if (m_Decimals > -1)
      factor = StrictMath.pow(10, m_Decimals);
    else
      factor = 1;
   
    for (i = 0; i < result.numAttributes(); i++) {
      // only numeric attributes
      if (!result.attribute(i).isNumeric())
  continue;

      // out of range?
View Full Code Here

    }
    else {
      outInst = inst;
    }

    for (i = 0; i < outInst.numAttributes(); i++) {
      if (i > 0)
  result.append(",");
      if (outInst.isMissing(i))
  result.append("?");
      else
View Full Code Here

            //and keep the track of the ball center and the maximum radius which can achieve the highest accuracy.
            if (correctCount > highestCount || (correctCount==highestCount && radius > m_Radius)){
              highestCount = correctCount;
              m_Radius = radius;
              for (int p=0; p<tempCenter.numAttributes(); p++)
                m_Center[p]= tempCenter.value(p);
            }     
          }
        }
      }
View Full Code Here

    m_delTransform.input(instance);
    m_delTransform.batchFinished();
    Instance dtInstance = m_delTransform.output();

    thekey = new DecisionTableHashKey(dtInstance, dtInstance.numAttributes(), false);

    // if this one is not in the table
    if ((tempDist = (double [])m_entries.get(thekey)) == null) {
      if (m_useIBk) {
  tempDist = m_ibk.distributionForInstance(dtInstance);
View Full Code Here

    if (isOutputFormatDefined()) {
      Instance newInstance = (Instance)instance.copy();
     
      // make sure that we get the right indexes set for the converted
      // string attributes when operating on a second batch of instances
      for (int i = 0; i < newInstance.numAttributes(); i++) {
        if (newInstance.attribute(i).isString() &&
            !newInstance.isMissing(i) &&
            m_AttIndices.isInRange(i)) {
          Attribute outAtt =
            getOutputFormat().attribute(newInstance.attribute(i).name());
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.