Package elki.utilities.scaling
Class LinearScaling
- java.lang.Object
-
- elki.utilities.scaling.LinearScaling
-
- All Implemented Interfaces:
ScalingFunction
,StaticScalingFunction
public class LinearScaling extends java.lang.Object implements StaticScalingFunction
Simple linear scaling function.- Since:
- 0.3
- Author:
- Erich Schubert
-
-
Constructor Summary
Constructors Constructor Description LinearScaling()
Constructor with defaults resulting in identity.LinearScaling(double factor)
Constructor with scaling only.LinearScaling(double factor, double shift)
Full constructor.LinearScaling(DoubleMinMax minmax)
Constructor from a double minmax.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LinearScaling
fromMinMax(double min, double max)
Make a linear scaling from a given minimum and maximum.double
getMax()
Get maximum resulting value.double
getMin()
Get minimum resulting value.double
getScaled(double d)
Transform a given value using the scaling function.
-
-
-
Constructor Detail
-
LinearScaling
public LinearScaling()
Constructor with defaults resulting in identity.
-
LinearScaling
public LinearScaling(double factor)
Constructor with scaling only.- Parameters:
factor
- Scaling factor
-
LinearScaling
public LinearScaling(double factor, double shift)
Full constructor.- Parameters:
factor
- Scaling factorshift
- Shift value
-
LinearScaling
public LinearScaling(DoubleMinMax minmax)
Constructor from a double minmax.- Parameters:
minmax
- Minimum and Maximum
-
-
Method Detail
-
getScaled
public double getScaled(double d)
Description copied from interface:ScalingFunction
Transform a given value using the scaling function.- Specified by:
getScaled
in interfaceScalingFunction
- Parameters:
d
- Original value- Returns:
- Scaled value
-
getMin
public double getMin()
Description copied from interface:ScalingFunction
Get minimum resulting value. May beDouble.NaN
orDouble.NEGATIVE_INFINITY
.- Specified by:
getMin
in interfaceScalingFunction
- Returns:
- Minimum resulting value.
-
getMax
public double getMax()
Description copied from interface:ScalingFunction
Get maximum resulting value. May beDouble.NaN
orDouble.POSITIVE_INFINITY
.- Specified by:
getMax
in interfaceScalingFunction
- Returns:
- Maximum resulting value.
-
fromMinMax
public static LinearScaling fromMinMax(double min, double max)
Make a linear scaling from a given minimum and maximum. The minimum will be mapped to zero, the maximum to one.- Parameters:
min
- Minimummax
- Maximum- Returns:
- New linear scaling.
-
-