org.dllearner.utilities.statistics
Class Stat

java.lang.Object
  extended by org.dllearner.utilities.statistics.Stat

public class Stat
extends Object

Utility class for calculating the mean and standard deviation of a given set of numbers. The class also contains convenience methods for printing values.

Author:
Jens Lehmann

Constructor Summary
Stat()
           
Stat(Set<Stat> stats)
          Creates a new stat object by merging several stat objects.
Stat(Stat stat1, Stat stat2)
          Creates a new stat object by merging two stat objects.
 
Method Summary
 void addNumber(double number)
          Add a number to this object.
 int getCount()
          Gets the number of numbers.
 double getMax()
           
 double getMean()
          Gets the mean of all numbers.
 String getMeanAsPercentage()
          Gets the mean of all numbers as percentage *100 so 0.5678 -> "56.78%"
 double getMin()
           
 double getStandardDeviation()
          Gets the standard deviation of all numbers.
 double getSum()
          Gets the sum of all numbers.
 String prettyPrint()
           
 String prettyPrint(String unit)
           
 String prettyPrint(String unit, DecimalFormat df)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stat

public Stat()

Stat

public Stat(Stat stat1,
            Stat stat2)
Creates a new stat object by merging two stat objects. The result is the same as if the numbers, which have been added to stat1 and stat2 would have been added to this stat object.

Parameters:
stat1 - Statistical object 1.
stat2 - Statistical object 2.

Stat

public Stat(Set<Stat> stats)
Creates a new stat object by merging several stat objects. The result is the same as if the numbers, which have been added to each stat would have been added to this stat object.

Parameters:
stat1 - Statistical object 1.
stat2 - Statistical object 2.
Method Detail

addNumber

public void addNumber(double number)
Add a number to this object.

Parameters:
number - The new number.

getCount

public int getCount()
Gets the number of numbers.

Returns:
The number of numbers.

getSum

public double getSum()
Gets the sum of all numbers.

Returns:
The sum of all numbers.

getMean

public double getMean()
Gets the mean of all numbers.

Returns:
The mean of all numbers.

getMeanAsPercentage

public String getMeanAsPercentage()
Gets the mean of all numbers as percentage *100 so 0.5678 -> "56.78%"

Returns:
The mean as formatted string.

getStandardDeviation

public double getStandardDeviation()
Gets the standard deviation of all numbers.

Returns:
The standard deviation of all numbers.

getMin

public double getMin()
Returns:
the min

getMax

public double getMax()
Returns:
the max

prettyPrint

public String prettyPrint()

prettyPrint

public String prettyPrint(String unit)

prettyPrint

public String prettyPrint(String unit,
                          DecimalFormat df)


SourceForge.net Logo DL-Learner is licenced under the terms of the GNU General Public License.
Copyright © 2007-2011 Jens Lehmann