Class ErrorCalculationMethod
java.lang.Object
net.simplace.sim.util.statistics.ErrorCalculationMethod
- Direct Known Subclasses:
AgreementIndex, Bias, ConcordanceCorrelationCoefficient, CorrelationCoefficient, EF, MAE, MRE, MSE, RMAE, RMSE, RRMSE, SMAPE, VoidErrorCalculator
Base class of the error calculation methods (goodness-of-fit measures) used by the selectors
(e.g.
LeastDifferenceSelector) and the output statistics. Pairs of observed and calculated values are
accumulated with addDataPair(double, double); getValue() returns the measure, and
isBetter(double, double) compares two values of the measure. Instances are created by
ErrorCalculationFactory.- Author:
- Gunther Krauss
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddDataPair(double observed, double calculated) Adds a pair of observed and calculated values.abstract StringgetLabel()abstract doublegetValue()Calculates the measure from the added pairs.doubleReturns the value that is considered worst by the error calculation method (the start value when searching the best value).voidinit()Resets the accumulated data for a new calculation.abstract booleanisBetter(double better, double worse) Checks if the first value is better than the second one with respect to the calculation method (e.g.
-
Field Details
-
count
protected int countnumber of data pairs added -
sum
protected double sumaccumulated sum (meaning depends on the method)
-
-
Constructor Details
-
ErrorCalculationMethod
public ErrorCalculationMethod()
-
-
Method Details
-
init
public void init()Resets the accumulated data for a new calculation. -
getWorstValue
public double getWorstValue()Returns the value that is considered worst by the error calculation method (the start value when searching the best value).- Returns:
- the worst value,
Double.MAX_VALUEby default
-
addDataPair
public abstract void addDataPair(double observed, double calculated) Adds a pair of observed and calculated values.- Parameters:
observed- the observed (measured) valuecalculated- the calculated (simulated) value
-
getValue
public abstract double getValue()Calculates the measure from the added pairs.- Returns:
- the value of the measure (the worst value if no pairs were added)
-
isBetter
public abstract boolean isBetter(double better, double worse) Checks if the first value is better than the second one with respect to the calculation method (e.g. smaller for errors, closer to 1 for model efficiency).- Parameters:
better- the value that is checked to be betterworse- the value to compare with- Returns:
trueif the first value is better than the second
-
getLabel
- Returns:
- the label (abbreviation) of the calculation method, e.g.
RMSE
-
getDescription
- Returns:
- the full name or a short description of the method (empty by default)
-