Package weka.core

Examples of weka.core.DenseInstance


    Instance example;
    int numAtts = getNumAttributes();
    if (getClassFlag())
      numAtts++;

    example = new DenseInstance(numAtts);
    example.setDataset(format);
       
    for (int i = 0; i < getNumAttributes(); i++)
      example.setValue(i, randomG.nextGaussian() * stdDev + center[i]);
   
View Full Code Here


    }

    if (sparse)
      result = new SparseInstance(weight, vals);
    else
      result = new DenseInstance(weight, vals);
    result.setDataset(data);
     
    return result;
  }
View Full Code Here

    //convert to coordinates in the training instance space.
  double x = convertFromPanelX(mouseX);
  double y = convertFromPanelY(mouseY);
 
  //build the training instance
  Instance newInstance = new DenseInstance(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);
    else if (i == m_yAttribute)
      newInstance.setValue(i,y);
    else newInstance.setMissing(i);
  }
 
  //add it to our data set.
  addTrainingInstance(newInstance);
  }
View Full Code Here

        m_dataGenerator.buildGenerator(m_trainingData);

        // generate samples
        m_weightingAttsValues = new double [m_attsToWeightOn.length];
        m_vals = new double[m_trainingData.numAttributes()];
        m_predInst = new DenseInstance(1.0, m_vals);
        m_predInst.setDataset(m_trainingData);

 
        m_size = 1 << 4// Current sample region size
 
View Full Code Here

    }
   
    if (inst instanceof SparseInstance) {
      return new SparseInstance(inst.weight(), newVals);
    } else {
      return new DenseInstance(inst.weight(), newVals);
    }     
  }
View Full Code Here

   
    if (!m_transBackToOriginal) {
      if (instance instanceof SparseInstance) {
      return new SparseInstance(instance.weight(), newVals);
      } else {
        return new DenseInstance(instance.weight(), newVals);
      }     
    } else {
      if (instance instanceof SparseInstance) {
        return convertInstanceToOriginal(new SparseInstance(instance.weight(),
                                                            newVals));
      } else {
        return convertInstanceToOriginal(new DenseInstance(instance.weight(),
                                                      newVals));
      }
    }
  }
View Full Code Here

    int num = -1;
    Instance example = null;
    int numAtts = m_NumAttributes;
    if (getClassFlag()) numAtts++;

    example = new DenseInstance(numAtts);
    example.setDataset(format);
    boolean[] attributes = cl.getAttributes();
    double[] minValue = cl.getMinValue();
    double[] maxValue = cl.getMaxValue();
    double value;
View Full Code Here

    Instance example = null;
    int numAtts = m_NumAttributes;
    if (getClassFlag()) numAtts++;

    example = new DenseInstance(numAtts);
    example.setDataset(format);
    boolean[] attributes = cl.getAttributes();
    double[] minValue = cl.getMinValue();
    double[] maxValue = cl.getMaxValue();
    double[] diff = new double[minValue.length];
View Full Code Here

    Instance example = null;
    int numAtts = m_NumAttributes;
    if (getClassFlag()) numAtts++;

    example = new DenseInstance(numAtts);
    example.setDataset(format);
    boolean[] attributes = cl.getAttributes();
    double[] minValue = cl.getMinValue();
    double[] maxValue = cl.getMaxValue();
    int[] minInt = new int[minValue.length];
View Full Code Here

    boolean makeInteger = cl.isInteger();
    Instance example = null;
    int numAtts = m_NumAttributes;
    if (getClassFlag()) numAtts++;

    example = new DenseInstance(numAtts);
    example.setDataset(format);
    boolean[] attributes = cl.getAttributes();
    double[] meanValue = cl.getMeanValue();
    double[] stddevValue = cl.getStddevValue();
View Full Code Here

TOP

Related Classes of weka.core.DenseInstance

Copyright © 2018 www.massapicom. 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.