fr.inrialpes.exmo.ontosim.aggregation
Class GenericMean
java.lang.Object
fr.inrialpes.exmo.ontosim.aggregation.AggregationScheme
fr.inrialpes.exmo.ontosim.aggregation.GenericMean
public class GenericMean
- extends AggregationScheme
Generic mean implementation
It follows the formula m=inversePhi(sum(phi(x)/n)
phi(x)=x -> arithmetic mean -> use new GenericMean(GenericMean.ARITHMETIC)
phi(x)=x^ -> quadratic mean -> use new GenericMean(GenericMean.QUADRATIC)
phi(x) = ln(x) -> geometric mean -> use new GenericMean(GenericMean.GEOMETRIC)
phi(x) = 1/x -> harmonic mean -> use new GenericMean(GenericMean.HARMONIC)
...
To implement a specific weighted average, it is enough to
override method protected int weight(double x) and add the specific
weighting formula
To implement another mean, implement a new Type
- Author:
- Jerome David
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INSTANCES
private static final Map<GenericMean.Type,GenericMean> INSTANCES
ARITHMETIC
public static final GenericMean.Type ARITHMETIC
QUADRATIC
public static final GenericMean.Type QUADRATIC
GEOMETRIC
public static final GenericMean.Type GEOMETRIC
HARMONIC
public static final GenericMean.Type HARMONIC
p
protected GenericMean.Type p
GenericMean
protected GenericMean(GenericMean.Type t)
GenericMean
protected GenericMean()
getInstance
public static GenericMean getInstance(GenericMean.Type t)
getValue
public final double getValue(double[] vals)
- Specified by:
getValue
in class AggregationScheme
weight
protected int weight(double x)
getValue
public final <O> double getValue(Measure<O> measure,
Matching<O> matching)
- Specified by:
getValue
in class AggregationScheme
(C) INRIA & friends, 2008-2009