Codota Logo
Stats
Code IndexAdd Codota to your IDE (free)

How to use
Stats
in
weka.experiment

Best Java code snippets using weka.experiment.Stats (Showing top 20 results out of 315)

  • Common ways to obtain Stats
private void myMethod () {
Stats s =
  • Codota Iconnew Stats()
  • Smart code suggestions by Codota
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Unweighted macro-averaged F-measure. If some classes not present in the
 * test set, they're just skipped (since recall is undefined there anyway) .
 *
 * @return unweighted macro-averaged F-measure.
 * */
public double unweightedMacroFmeasure() {
 weka.experiment.Stats rr = new weka.experiment.Stats();
 for (int c = 0; c < m_NumClasses; c++) {
  // skip if no testing positive cases of this class
  if (numTruePositives(c) + numFalseNegatives(c) > 0) {
   rr.add(fMeasure(c));
  }
 }
 rr.calculateDerived();
 return rr.mean;
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Removes a value to the observed values (no checking is done
 * that the value being removed was actually added).<p>
 * 
 * It's equivalent to <code>subtract(value, 1)</code><p>
 *
 * @param value the observed value
 */
public void subtract(double value) {
 subtract(value, 1);
}
origin: nz.ac.waikato.cms.weka/weka-stable

 add(value, -weight);
 return;
if (isInvalid())
 return;
 goInvalid();
 return;
 reset();
 return;
} else if (count < 0) {
 negativeCount();
 return;
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Updates the counters for one more observed distinct value.
 *
 * @param value the value that has just been seen
 * @param count the number of times the value appeared
 * @param weight the weight mass of the value
 */
protected void addDistinct(double value, int count, double weight) {
 if (count > 0) {
  if (count == 1) {
   uniqueCount++;
  }
  if (value == (int)value) {
   intCount += count;
  } else {
   realCount += count;
  }
  if (nominalCounts != null) {
   nominalCounts[(int) value] = count;
   nominalWeights[(int) value] = weight;
  }
  if (numericStats != null) {
   //numericStats.add(value, count);
   numericStats.add(value, weight);
   numericStats.calculateDerived();
  }
 }
 distinctCount++;
}
origin: nz.ac.waikato.cms.moa/moa

      new int[m_clusterInstances.attribute(i).numValues()];
} else {
  m_attStats[i].numericStats = new Stats();
} else {
  if (delete) {
    m_attStats[i].numericStats.subtract(value,
        updateInstance.weight());
  } else {
    m_attStats[i].numericStats.add(value, updateInstance.weight());
origin: nz.ac.waikato.cms.moa/moa

/**
 * Returns the standard deviation of a numeric attribute
 *
 * @param attIndex the index of the attribute
 * @return the standard deviation
 * @throws Exception if an error occurs
 */
protected double getStandardDev(int attIndex) { //throws Exception {
  //  if (!m_clusterInstances.attribute(attIndex).isNumeric()) {
  //throw new Exception("getStandardDev: attribute is not numeric");
  // }
  m_attStats[attIndex].numericStats.calculateDerived();
  double stdDev = m_attStats[attIndex].numericStats.stdDev;
  if (Double.isNaN(stdDev) || Double.isInfinite(stdDev)) {
    return m_acuity;
  }
  return Math.max(m_acuity, stdDev);
}
origin: nz.ac.waikato.cms.weka/weka-stable

 double value = Double.longBitsToDouble(adds[j]);
 double weight = Double.longBitsToDouble(adds[j + 1]);
 stats.add(value, weight);
stats.add(value, weight);
b.add(value); b.add(weight);
 stats.subtract(b.get(0), b.get(1));
 b.remove(1); b.remove(0);
stats.subtract(b.get(i), b.get(i + 1));
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Adds a value to the observed values<p>
 * 
 * It's equivalent to <code>add(value, 1)</code><p>
 *
 * @param value the observed value
 */
public void add(double value) {
 add(value, 1);
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Creates a new PairedStats object with the supplied significance level.
 *
 * @param sig the significance level for comparisons
 */
public PairedStats(double sig) {
  
 xStats = new Stats();
 yStats = new Stats();
 differencesStats = new Stats();
 sigLevel = sig;
}
origin: nz.ac.waikato.cms.weka/weka-stable

 subtract(value, -weight);
 return;
if (isInvalid())
 return;
 goInvalid();
 return;
 reset();
 return;
origin: nz.ac.waikato.cms.weka/weka-stable

private void goInvalid() {
 count = Double.NaN;
 negativeCount();
}
origin: nz.ac.waikato.cms.weka/weka-stable

  i).numValues()];
} else {
 m_attStats[i].numericStats = new Stats();
} else {
 if (delete) {
  m_attStats[i].numericStats.subtract(value,
   updateInstance.weight());
 } else {
  m_attStats[i].numericStats.add(value, updateInstance.weight());
origin: Waikato/weka-trunk

/**
 * Updates the counters for one more observed distinct value.
 *
 * @param value the value that has just been seen
 * @param count the number of times the value appeared
 * @param weight the weight mass of the value
 */
protected void addDistinct(double value, int count, double weight) {
 if (count > 0) {
  if (count == 1) {
   uniqueCount++;
  }
  if (value == (int)value) {
   intCount += count;
  } else {
   realCount += count;
  }
  if (nominalCounts != null) {
   nominalCounts[(int) value] = count;
   nominalWeights[(int) value] = weight;
  }
  if (numericStats != null) {
   //numericStats.add(value, count);
   numericStats.add(value, weight);
   numericStats.calculateDerived();
  }
 }
 distinctCount++;
}
origin: nz.ac.waikato.cms.weka/weka-stable

xStats.calculateDerived();
yStats.calculateDerived();
differencesStats.calculateDerived();
origin: Waikato/weka-trunk

 double value = Double.longBitsToDouble(adds[j]);
 double weight = Double.longBitsToDouble(adds[j + 1]);
 stats.add(value, weight);
stats.add(value, weight);
b.add(value); b.add(weight);
 stats.subtract(b.get(0), b.get(1));
 b.remove(1); b.remove(0);
stats.subtract(b.get(i), b.get(i + 1));
origin: Waikato/weka-trunk

/**
 * Adds a value to the observed values<p>
 * 
 * It's equivalent to <code>add(value, 1)</code><p>
 *
 * @param value the observed value
 */
public void add(double value) {
 add(value, 1);
}
origin: Waikato/weka-trunk

/**
 * Creates a new PairedStats object with the supplied significance level.
 *
 * @param sig the significance level for comparisons
 */
public PairedStats(double sig) {
  
 xStats = new Stats();
 yStats = new Stats();
 differencesStats = new Stats();
 sigLevel = sig;
}
origin: Waikato/weka-trunk

 subtract(value, -weight);
 return;
if (isInvalid())
 return;
 goInvalid();
 return;
 reset();
 return;
origin: Waikato/weka-trunk

private void goInvalid() {
 count = Double.NaN;
 negativeCount();
}
origin: Waikato/weka-trunk

/**
 * Unweighted macro-averaged F-measure. If some classes not present in the
 * test set, they're just skipped (since recall is undefined there anyway) .
 *
 * @return unweighted macro-averaged F-measure.
 * */
public double unweightedMacroFmeasure() {
 weka.experiment.Stats rr = new weka.experiment.Stats();
 for (int c = 0; c < m_NumClasses; c++) {
  // skip if no testing positive cases of this class
  if (numTruePositives(c) + numFalseNegatives(c) > 0) {
   rr.add(fMeasure(c));
  }
 }
 rr.calculateDerived();
 return rr.mean;
}
weka.experimentStats

Javadoc

A class to store simple statistics.

Upon initialization the variables take the following values:

#count = #sum = #sumSq = 0
#mean = #stdDev = #min = #max = Double.NaN

This is called the initial state.

For signaling that a Stats object has been provided with values that hint that something is either wrong with the data used or the algorithm used there is also the invalid state where the variables take the following values:

#count = #sum = #sumSq = #mean = #stdDev = #min = #max = Double.NaN

Once a Stats object goes into the invalid state it can't change its state anymore.

A Stats object assumes that only values are subtracted (by using the #subtract(double) or #subtract(double,double) methods) that have previously been added (by using the #add(double) or #add(double,double) methods) and the weights must be the same too.
Otherwise the Stats object's fields' values are implementation defined.

If the implementation detects a problem then the Stats object goes into the invalid state.

The fields #count, #sum, #sumSq, #min and #max are always updated whereas the field #mean and #stdDev are only guaranteed to be updated after a call to #calculateDerived().

For the fields #min and #max the following rules apply:

min(values_added \ values_subtracted) >= #min >= min(values_added)
max(values_added \ values_subtracted)

Where \ is the set difference.

For the field #stdDev the following rules apply:

  1. If count
  2. Otherwise #stdDev >= 0 and it should take on the value by best effort of the implementation.
For the methods #add(double), #add(double,double), #subtract(double) and #subtract(double,double) the following rules apply:

  1. if weight < 0 then #subtract(double,double) is used instead of #add(double,double) with weight = -weight and vice versa.
  2. if weight = +-inf or weight = NaN then the Stats object goes into the invalid state.
  3. if value = +-inf or value = NaN then the Stats object goes into the invalid state.
  4. if weight = 0 then the value gets ignored.
  5. Otherwise the fields get updated by the implementation's best effort.
For #count the following rules apply

  1. If #count goes below zero then all fields are set to Double.NaN except the #count field which gets tracked normally.
  2. If #count = 0 then the Stats object goes into the initial state.
  3. If #count > 0 for the first time, then the Stats object goes into initial state and gets updated with the corresponding value and weight.

Most used methods

  • <init>
  • add
    Adds a weighted value to the observed values
  • calculateDerived
    Tells the object to calculate any statistics that don't have their values automatically updated duri
  • subtract
    Subtracts a weighted value from the observed values
  • goInvalid
  • isInvalid
  • negativeCount
  • reset

Popular in Java

  • Updating database using SQL prepared statement
  • putExtra (Intent)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • Set (java.util)
    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • Pattern (java.util.regex)
    A compiled representation of a regular expression. A regular expression, specified as a string, must
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JLabel (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now