Package weka.core

Examples of weka.core.Instances.variance()


    m_FullMeansOrMediansOrModes = moveCentroid(0, instances, false);
    for (int i = 0; i < instances.numAttributes(); i++) {
      m_FullMissingCounts[i] = instances.attributeStats(i).missingCount;
      if (instances.attribute(i).isNumeric()) {
        if (m_displayStdDevs) {
          m_FullStdDevs[i] = Math.sqrt(instances.variance(i));
        }
        if (m_FullMissingCounts[i] == instances.numInstances()) {
          m_FullMeansOrMediansOrModes[i] = Double.NaN; // mark missing as mean
        }
      } else {
View Full Code Here


    // 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

      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
      for(int i = 0; i < input.numInstances(); i++) {
View Full Code Here

    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()) {
          m_FullMeansOrModes[i] = Double.NaN; // mark missing as mean
        }
      } else {
View Full Code Here

    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))
        //  t++; 
View Full Code Here

    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

        */

      Instances pxi =  pos.instance(v).relationalValue(1);
      for (int k=0; k<pxi.numAttributes(); k++) {
        m_MeanP[v][k] = pxi.meanOrMode(k);
        m_VarianceP[v][k] = pxi.variance(k);
      }

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

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

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

    double[] n = new double[m_Dimension];
    double [] xBar = new double[m_Dimension];
    double [] sSq = new double[m_Dimension];
    for (int i=0; i<exi.numAttributes() ; i++){
      xBar[i] = exi.meanOrMode(i);
      sSq[i] = exi.variance(i);
    }

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

      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
      for(int i = 0; i < input.numInstances(); i++) {
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.