@DefaultProvider(value=PreferenceDomainQuantizer.AutoProvider.class) public interface Quantizer
Quantize real values into discrete values. Used to do things like map floating point ratings or predictions to discrete rating values. By default, if there is a preference domain available, a PreferenceDomainQuantizer
will be used to implement this interface.
Modifier and Type | Method and Description |
---|---|
int |
getCount()
Get the number of discrete values the output can take.
|
double |
getIndexValue(int i)
Get the value corresponding to a quantized value, based on the index into the list of possible values.
|
org.apache.commons.math3.linear.RealVector |
getValues()
Get the possible values into which this quantizer will map input values.
|
int |
index(double val)
Convert a value into a discrete, quantized value.
|
double |
quantize(double val)
Convert a value into a quantized value, returning the quantized value.
|
org.apache.commons.math3.linear.RealVector getValues()
Get the possible values into which this quantizer will map input values. These are the values corresponding to each “bin” into which the quantizer will put values.
double getIndexValue(int i)
Get the value corresponding to a quantized value, based on the index into the list of possible values.
i
- The quantized value number, in the range [0,n) where n is the number of possible discrete values (see getCount()
).i
.IllegalArgumentException
- if i
is an invalid discrete value.int getCount()
Get the number of discrete values the output can take.
int index(double val)
Convert a value into a discrete, quantized value.
val
- A value to quantize.val
is mapped.double quantize(double val)
Convert a value into a quantized value, returning the quantized value.
val
- A value to quantize.