Package weka.core

Examples of weka.core.Instance.numAttributes()


  vInd = (int)instance.classValue();
      }

      // Iterate through all relevant string attributes of the current instance
      Hashtable h = new Hashtable();
      for (int j = 0; j < instance.numAttributes(); j++) {
  if (m_SelectedRange.isInRange(j) && (instance.isMissing(j) == false)) {

    // Get tokenizer
    m_Tokenizer.tokenize(instance.stringValue(j));
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

        firstInstance().classIndex());
    // training iteration
    for (int i = 1; i < data.numInstances(); i++) { //for all instances
      Instance inst = data.instance(i);
      int flag =0;
      for(int w=0;w<inst.numAttributes()-1;w++){
        if(w!=inst.classIndex() && inst.isMissing(w))
          flag=flag+1;
      }
      if (!inst.classIsMissing()&&flag!=inst.numAttributes()-1) {
        inputBuffer = new FuzzyLattice( (Instance) data.instance(i), bounds);
View Full Code Here

      int flag =0;
      for(int w=0;w<inst.numAttributes()-1;w++){
        if(w!=inst.classIndex() && inst.isMissing(w))
          flag=flag+1;
      }
      if (!inst.classIsMissing()&&flag!=inst.numAttributes()-1) {
        inputBuffer = new FuzzyLattice( (Instance) data.instance(i), bounds);
        double[] sigma = new double[ (learnedCode.size())];

        for (int j = 0; j < learnedCode.size(); j++) {
          FuzzyLattice num = (FuzzyLattice) learnedCode.get(j);
View Full Code Here

    for (int i = 0; i < instances.numInstances(); i++) {
      instance = instances.instance(i);

      double log_row = 0.0;

      for (int j = 0; j < instance.numAttributes(); j++) {
        if (instance.value(j) != 0.0) {
          log_row += (betas[j] * instance.value(j) * instance.value(j));
        }
      }

View Full Code Here

  vInd = (int)instance.classValue();
      }

      // Iterate through all relevant string attributes of the current instance
      Hashtable h = new Hashtable();
      for (int j = 0; j < instance.numAttributes(); j++) {
  if (m_SelectedRange.isInRange(j) && (instance.isMissing(j) == false)) {

    // Get tokenizer
    m_Tokenizer.tokenize(instance.stringValue(j));
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

    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

        Filter filter = aset.createFilter(data);
        Instances newData = Filter.useFilter(data, filter);
        for (int i = 0, cnt = newData.numInstances(); i < cnt; i++) {
            Instance processed = newData.instance(i);
//            System.err.println(processed);
            assertEquals(aset.size(), processed.numAttributes());
        } // WHILE
        assertEquals(data.numInstances(), newData.numInstances());
//        System.err.println("MarkovAttributeSet: " + aset);
       
    }
View Full Code Here

  double x = convertFromPanelX(mouseX);
  double y = convertFromPanelY(mouseY);
 
  //build the training instance
  Instance newInstance = new Instance(m_trainingData.numAttributes());
  for (int i = 0; i < newInstance.numAttributes(); i++) {
    if (i == classAttIndex) {
      newInstance.setValue(i,classValue);
    }
    else if (i == m_xAttribute)
      newInstance.setValue(i,x);
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.