Package weka.experiment
Class Stats
java.lang.Object
weka.experiment.Stats
- All Implemented Interfaces:
Serializable,RevisionHandler
A class to store simple statistics
- Version:
- $Revision: 1.12 $
- Author:
- Len Trigg (trigg@cs.waikato.ac.nz)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleThe number of values seendoubleThe maximum value seen, or Double.NaN if no values seendoubleThe mean of values at the last calculateDerived() calldoubleThe minimum value seen, or Double.NaN if no values seendoubleThe std deviation of values at the last calculateDerived() calldoubleThe sum of values seendoubleThe sum of values squared seen -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double value) Adds a value to the observed valuesvoidadd(double value, double n) Adds a value that has been seen n times to the observed valuesvoidTells the object to calculate any statistics that don't have their values automatically updated during add.Returns the revision string.static voidTests the paired stats object from the command line.voidsubtract(double value) Removes a value to the observed values (no checking is done that the value being removed was actually added).voidsubtract(double value, double n) Subtracts a value that has been seen n times from the observed valuestoString()Returns a string summarising the stats so far.
-
Field Details
-
count
public double countThe number of values seen -
sum
public double sumThe sum of values seen -
sumSq
public double sumSqThe sum of values squared seen -
stdDev
public double stdDevThe std deviation of values at the last calculateDerived() call -
mean
public double meanThe mean of values at the last calculateDerived() call -
min
public double minThe minimum value seen, or Double.NaN if no values seen -
max
public double maxThe maximum value seen, or Double.NaN if no values seen
-
-
Constructor Details
-
Stats
public Stats()
-
-
Method Details
-
add
public void add(double value) Adds a value to the observed values- Parameters:
value- the observed value
-
add
public void add(double value, double n) Adds a value that has been seen n times to the observed values- Parameters:
value- the observed valuen- the number of times to add value
-
subtract
public void subtract(double value) Removes a value to the observed values (no checking is done that the value being removed was actually added).- Parameters:
value- the observed value
-
subtract
public void subtract(double value, double n) Subtracts a value that has been seen n times from the observed values- Parameters:
value- the observed valuen- the number of times to subtract value
-
calculateDerived
public void calculateDerived()Tells the object to calculate any statistics that don't have their values automatically updated during add. Currently updates the mean and standard deviation. -
toString
Returns a string summarising the stats so far. -
getRevision
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Returns:
- the revision
-
main
Tests the paired stats object from the command line. reads line from stdin, expecting two values per line.- Parameters:
args- ignored.
-