com.rapidminer.tools.math
Class Averagable

java.lang.Object
  extended by com.rapidminer.operator.AbstractIOObject
      extended by com.rapidminer.operator.ResultObjectAdapter
          extended by com.rapidminer.tools.math.Averagable
All Implemented Interfaces:
IOObject, ResultObject, Readable, Reportable, LoggingHandler, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
AttributeWeight, PerformanceCriterion

public abstract class Averagable
extends ResultObjectAdapter
implements java.lang.Cloneable, Readable

Superclass for all objects which can be averaged. Averagable objects can be stored in a average vector.

Author:
Ingo Mierswa
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.rapidminer.operator.AbstractIOObject
AbstractIOObject.InputStreamProvider
 
Constructor Summary
Averagable()
           
Averagable(Averagable o)
           
 
Method Summary
 void buildAverage(Averagable averagable)
          This method builds the makro average of two averagables of the same type.
protected abstract  void buildSingleAverage(Averagable averagable)
          This method should build the average of this and another averagable of the same type.
 java.lang.Object clone()
          Returns a (deep) clone of this averagable.
protected  void cloneAveragable(Averagable other)
          Deprecated. Please use copy constructors instead
 boolean formatPercent()
          Indicates wether or not percentage format should be used in the toString() method.
 double getAverage()
          This method returns the makro average if it was defined and the mikro average (the current value) otherwise.
 int getAverageCount()
          Returns the number of averagables used to create this averagable.
 java.lang.String getExtension()
           
 java.lang.String getFileDescription()
           
 double getMakroAverage()
          Returns the average value of all performance criteria average by using the buildAverage(Averagable) method.
 double getMakroStandardDeviation()
          Returns the standard deviation of all performance criteria average by using the buildAverage(Averagable) method.
 double getMakroVariance()
          Returns the variance of all performance criteria average by using the buildAverage(Averagable) method.
abstract  double getMikroAverage()
          Returns the (current) value of the averagable (the average itself).
 double getMikroStandardDeviation()
          Returns the standard deviation of the performance criterion.
abstract  double getMikroVariance()
          Returns the variance of the averagable.
abstract  java.lang.String getName()
          Returns the name of this averagable.
 double getStandardDeviation()
          This method returns the makro standard deviation if it was defined and the mikro standard deviation otherwise.
 double getVariance()
          This method returns the makro variance if it was defined and the mikro variance otherwise.
 boolean isInTargetEncoding()
           
 void setAverageCount(int averageCount)
           
 java.lang.String toString()
           
 
Methods inherited from class com.rapidminer.operator.ResultObjectAdapter
addAction, getActions, getAnnotations, getResultIcon, log, log, logError, logNote, logWarning, toHTML, toResultString
 
Methods inherited from class com.rapidminer.operator.AbstractIOObject
appendOperatorToHistory, copy, getLog, getProcessingHistory, getSource, initWriting, read, read, read, read, setLoggingHandler, setSource, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rapidminer.operator.IOObject
appendOperatorToHistory, copy, getLog, getProcessingHistory, getSource, setLoggingHandler, setSource, write
 

Constructor Detail

Averagable

public Averagable()

Averagable

public Averagable(Averagable o)
Method Detail

getName

public abstract java.lang.String getName()
Returns the name of this averagable. The returned string should only contain lowercase letters and underscore (RapidMiner parameter format) since the names will be automatically used for GUI purposes.

Specified by:
getName in interface ResultObject
Overrides:
getName in class ResultObjectAdapter

getMikroAverage

public abstract double getMikroAverage()
Returns the (current) value of the averagable (the average itself). If the method buildSingleAverage(Averagable) was used, this method must return the micro average from both (or more) criteria. This is usually achieved by correctly implementing buildSingleAverage(Averagable).


getMikroVariance

public abstract double getMikroVariance()
Returns the variance of the averagable. The returned value must not be negative. If the averagable does not define a variance this method should return Double.NaN.


cloneAveragable

@Deprecated
protected final void cloneAveragable(Averagable other)
Deprecated. Please use copy constructors instead

Must be implemented by subclasses such that it copies all values of other to this. When this method is called, it is guaranteed, that other is a subclass of the class of the object it is called on.


buildSingleAverage

protected abstract void buildSingleAverage(Averagable averagable)
This method should build the average of this and another averagable of the same type. The next invocation of getMikroAverage() should return the average of this and the given averagable. Hence, this method is used to build the actual micro average value of two criteria. Please refer to SimpleCriterion for a simple implementation example.


buildAverage

public final void buildAverage(Averagable averagable)
This method builds the makro average of two averagables of the same type. First this method checks if the classes of this and performance are the same and if the getName() methods return the same String. Otherwise a RuntimeException is thrown.
The value of averagable.getMikroAverage() is added to meanSum, its square is added to meanSquaredSum and averageCount is increased by one. These values are used in the getMakroAverage() and getMakroVariance() methods.
Subclasses should implement the method buildSingleAverage() to build the mikro (weighted) average of this averagable and the given averagable. They must be weighted by the number of examples used for calculating the averagables.


getAverage

public final double getAverage()
This method returns the makro average if it was defined and the mikro average (the current value) otherwise. This method should be used instead of getMikroAverage() for optimization purposes, i.e. by methods like getFitness() of performance criteria.


getVariance

public final double getVariance()
This method returns the makro variance if it was defined and the mikro variance otherwise.


getStandardDeviation

public final double getStandardDeviation()
This method returns the makro standard deviation if it was defined and the mikro standard deviation otherwise.


getMikroStandardDeviation

public final double getMikroStandardDeviation()
Returns the standard deviation of the performance criterion.


getMakroAverage

public final double getMakroAverage()
Returns the average value of all performance criteria average by using the buildAverage(Averagable) method.


getMakroVariance

public final double getMakroVariance()
Returns the variance of all performance criteria average by using the buildAverage(Averagable) method.


getMakroStandardDeviation

public final double getMakroStandardDeviation()
Returns the standard deviation of all performance criteria average by using the buildAverage(Averagable) method.


getAverageCount

public int getAverageCount()
Returns the number of averagables used to create this averagable.


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a (deep) clone of this averagable.

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

formatPercent

public boolean formatPercent()
Indicates wether or not percentage format should be used in the toString() method. The default implementation returns false.


getExtension

public java.lang.String getExtension()

getFileDescription

public java.lang.String getFileDescription()

toString

public java.lang.String toString()
Specified by:
toString in interface Readable
Overrides:
toString in class java.lang.Object

isInTargetEncoding

public boolean isInTargetEncoding()
Specified by:
isInTargetEncoding in interface Readable

setAverageCount

public void setAverageCount(int averageCount)


Copyright © 2001-2009 by Rapid-I