net.sf.myra.datamining
Class UnitAveragingMode<V extends java.lang.Comparable<V>>

java.lang.Object
  extended by net.sf.myra.datamining.UnitAveragingMode<V>
Direct Known Subclasses:
PRCurveMeasure.CurveAreaUnitAveragingMode, UnitAveragingMode.DoubleUnitAveragingMode

public abstract class UnitAveragingMode<V extends java.lang.Comparable<V>>
extends java.lang.Object

Version:
$Revision$ $Date:: #$
Author:
Fernando Esteban Barril Otero

Nested Class Summary
static class UnitAveragingMode.DoubleUnitAveragingMode
          Default averaging mode for Double values.
 
Constructor Summary
UnitAveragingMode()
           
 
Method Summary
 java.lang.String average(Unit<?>[] values)
          Returns a String which corresponds to the average values of the specified units.
 int compare(Unit<?> u1, Unit<?> u2)
           
protected  int compareTo(Unit<V> u1, Unit<V> u2)
          Compares the specified unit instances.
static UnitAveragingMode<?> get(java.lang.Class<?> c)
           
protected abstract  java.lang.String getAverage(Unit<V>[] values)
          Returns a String which corresponds to the average values of the specified units.
static void register(java.lang.Class<?> c, UnitAveragingMode<?> mode)
          Registers the specified averaging mode.
static java.lang.String stdev(java.util.Collection<? extends java.lang.Number> numbers)
           
static java.lang.String stdev(double[] numbers)
          Caculates the mean and standard deviation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnitAveragingMode

public UnitAveragingMode()
Method Detail

register

public static void register(java.lang.Class<?> c,
                            UnitAveragingMode<?> mode)
Registers the specified averaging mode.

Parameters:
c - the target unit class name.
mode - the averaging mode instance.

get

public static UnitAveragingMode<?> get(java.lang.Class<?> c)

stdev

public static java.lang.String stdev(java.util.Collection<? extends java.lang.Number> numbers)

stdev

public static java.lang.String stdev(double[] numbers)
Caculates the mean and standard deviation. This method calculates the traditional (not cross-validation) standard deviation measure.

Parameters:
numbers - the distribution.

average

public java.lang.String average(Unit<?>[] values)
Returns a String which corresponds to the average values of the specified units.

Parameters:
values - the array of unit values.
Returns:
a String which corresponds to the average values of the specified units.

compare

public int compare(Unit<?> u1,
                   Unit<?> u2)

getAverage

protected abstract java.lang.String getAverage(Unit<V>[] values)
Returns a String which corresponds to the average values of the specified units.

Parameters:
values - the array of unit values.
Returns:
a String which corresponds to the average values of the specified units.

compareTo

protected int compareTo(Unit<V> u1,
                        Unit<V> u2)
Compares the specified unit instances.

Parameters:
u1 - the first unit.
u2 - the second unit.
Returns:
a negative integer, zero, or a positive integer as u1 is less than, equal to, or greater than the specified u2.


Copyright © 2013. All Rights Reserved.