Examples of meanOrMode()


Examples of weka.core.Instances.meanOrMode()

    assertEquals(m_Instances.numInstances(),  result.numInstances());

    // Check conversion is OK
    for (int j = 0; j < result.numAttributes(); j++) {
      if (result.attribute(j).isNumeric()) {
  double mean = result.meanOrMode(j);
  assertTrue("Mean should be 0", Utils.eq(mean, 0));
  double stdDev = Math.sqrt(result.variance(j));
  assertTrue("StdDev should be 1 (or 0)",
       Utils.eq(stdDev, 0) || Utils.eq(stdDev, 1));
      }
View Full Code Here

Examples of weka.core.Instances.meanOrMode()

      Instances input = getInputFormat();
      m_Means = new double[input.numAttributes()];
      for (int i = 0; i < input.numAttributes(); i++) {
  if (input.attribute(i).isNumeric() &&
      (input.classIndex() != i)) {
    m_Means[i] = input.meanOrMode(i);
  }
      }

      // Convert pending input instances
      for (int i = 0; i < input.numInstances(); i++)
View Full Code Here

Examples of weka.core.Instances.meanOrMode()

      m_Means = new double[input.numAttributes()];
      m_StdDevs = new double[input.numAttributes()];
      for (int i = 0; i < input.numAttributes(); i++) {
  if (input.attribute(i).isNumeric() &&
      (input.classIndex() != i)) {
    m_Means[i] = input.meanOrMode(i);
    m_StdDevs[i] = Math.sqrt(input.variance(i));
  }
      }

      // Convert pending input instances
View Full Code Here

Examples of weka.core.Instances.meanOrMode()

      m_FullStdDevs = new double[instances.numAttributes()];
    }
    m_FullNominalCounts = new int[instances.numAttributes()][0];
    for (int i = 0; i < instances.numAttributes(); i++) {
      m_FullMissingCounts[i] = instances.attributeStats(i).missingCount;
      m_FullMeansOrModes[i] = instances.meanOrMode(i);
      if (instances.attribute(i).isNumeric()) {
        if (m_displayStdDevs) {
          m_FullStdDevs[i] = Math.sqrt(instances.variance(i));
        }
        if (m_FullMissingCounts[i] == instances.numInstances()) {
View Full Code Here

Examples of weka.core.Instances.meanOrMode()

    if (inst.attribute(m_target).isNumeric()) {
      if (m_supportCount > m_numInstances) {
        m_errorMessage = "Error: support set to more instances than there are in the data!";
        return;
      }
      m_globalTarget = inst.meanOrMode(m_target);
    } else {
      double[] probs = new double[inst.attributeStats(m_target).nominalCounts.length];
      for (int i = 0; i < probs.length; i++) {
        probs[i] = (double)inst.attributeStats(m_target).nominalCounts[i];
      }
View Full Code Here

Examples of weka.core.Instances.meanOrMode()

      Instances input = getInputFormat();
      m_Means = new double[input.numAttributes()];
      for (int i = 0; i < input.numAttributes(); i++) {
  if (input.attribute(i).isNumeric() &&
      (input.classIndex() != i)) {
    m_Means[i] = input.meanOrMode(i);
  }
      }

      // Convert pending input instances
      for (int i = 0; i < input.numInstances(); i++)
View Full Code Here

Examples of weka.core.Instances.meanOrMode()

      Instances data = bag.relationalValue(1); // retrieve relational value for each bag
      for(int j=0; j<data.numAttributes( ); j++){  
        double value;
        if(m_TransformMethod == TRANSFORMMETHOD_ARITHMETIC){
          value = data.meanOrMode(j);
          newInst.setValue(attIdx++, value);
        }
        else if (m_TransformMethod == TRANSFORMMETHOD_GEOMETRIC){
          double[] minimax = minimax(data, j);
          value = (minimax[0]+minimax[1])/2.0;
View Full Code Here

Examples of weka.core.Instances.meanOrMode()

    // Extract metadata from both positive and negative bags
    for(int v=0; v < pnum; v++){
      //Instance px = pos.instance(v);
      Instances pxi =  pos.instance(v).relationalValue(1);
      for (int k=0; k<pxi.numAttributes(); k++) {
        m_MeanP[v][k] = pxi.meanOrMode(k);
        varP[v][k] = pxi.variance(k);
      }

      for (int w=0,t=0; w < m_Dimension; w++,t++){   
        //if((t==m_ClassIndex) || (t==m_IdIndex))
View Full Code Here

Examples of weka.core.Instances.meanOrMode()

    for(int v=0; v < nnum; v++){
      //Instance nx = neg.instance(v);
      Instances nxi = neg.instance(v).relationalValue(1);
      for (int k=0; k<nxi.numAttributes(); k++) {
        m_MeanN[v][k] = nxi.meanOrMode(k);
        varN[v][k] = nxi.variance(k);
      }
      //Instances nxi =  nx.getInstances();

      for (int w=0,t=0; w < m_Dimension; w++,t++){
View Full Code Here

Examples of weka.core.Instances.meanOrMode()

    //Instance ex = new Exemplar(e);
    Instances exi = ex.relationalValue(1);
    double[] n = new double[m_Dimension];
    double [] xBar = new double[m_Dimension];
    for (int i=0; i<exi.numAttributes() ; i++)
      xBar[i] = exi.meanOrMode(i);

    for (int w=0, t=0; w < m_Dimension; w++, t++){
      // if((t==m_ClassIndex) || (t==m_IdIndex))
      //t++; 
      for(int u=0;u<exi.numInstances();u++)
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.