Package org.matsim.contrib.common.stats
Class LogDiscretizer
- java.lang.Object
-
- org.matsim.contrib.common.stats.LogDiscretizer
-
- All Implemented Interfaces:
Discretizer
public class LogDiscretizer extends Object implements Discretizer
A discretizer with logarithmically scaled bins.- Author:
- illenberger
-
-
Constructor Summary
Constructors Constructor Description LogDiscretizer(double base)
Creates a new discretizer.LogDiscretizer(double base, double upperBound)
Creates a new discretizer where values greater than upperBound are rounded down to upperBound.LogDiscretizer(double base, double upperBound, double lowerBound)
Creates a new discretizer where values greater than upperBound are rounded down to upperBound and values less than lowerBound are rounded up to lowerBound.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
binWidth(double value)
Returns the bin's width of which value is associated to.double
discretize(double value)
Returns the bin's value of which value is associated to.int
index(double value)
Returns the bin's index of which values is associated to.
-
-
-
Constructor Detail
-
LogDiscretizer
public LogDiscretizer(double base)
Creates a new discretizer. Values less than 1 are rounded up to 1.- Parameters:
base
- the base of the logarithm
-
LogDiscretizer
public LogDiscretizer(double base, double upperBound)
Creates a new discretizer where values greater than upperBound are rounded down to upperBound. Values less than 1 are rounded up to 1.- Parameters:
base
- the base of the logarithmupperBound
- the upper bound
-
LogDiscretizer
public LogDiscretizer(double base, double upperBound, double lowerBound)
Creates a new discretizer where values greater than upperBound are rounded down to upperBound and values less than lowerBound are rounded up to lowerBound.- Parameters:
base
- the base of the logarithmupperBound
- the upper boundlowerBound
- the lower bound
-
-
Method Detail
-
discretize
public double discretize(double value)
Description copied from interface:Discretizer
Returns the bin's value of which value is associated to.- Specified by:
discretize
in interfaceDiscretizer
- Parameters:
value
- a value- Returns:
- the bin's value
-
binWidth
public double binWidth(double value)
Description copied from interface:Discretizer
Returns the bin's width of which value is associated to.- Specified by:
binWidth
in interfaceDiscretizer
- Parameters:
value
- a value- Returns:
- the width of the bin of value. The width of the 0-th bin is 1.
-
index
public int index(double value)
Description copied from interface:Discretizer
Returns the bin's index of which values is associated to.- Specified by:
index
in interfaceDiscretizer
- Parameters:
value
- the value to discretize- Returns:
- the index of the bin
-
-