public class Entropy extends Function
Entropy
evaluation. This is the randomness or
purity of the distribution, comparing between each data point in the dataset.
The result is factored to be in the range 0 to 1, where 1 is maximum purity.
If entropy measures the amount of disorder, then typically, a larger values means
less pure and more disorder, but to mathCompare with the other metrics this has been
reversed by dividing 1.0 by the entropy value. You can reverse this again in your
code by dividing 1.0 by the result again when it is returned.
Each data point is numerical and should be of type Float, Double, Long or Integer
.
Some help from Ethan Croteau at http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=3319&lngWId=2
config, mathCompare, valueType
Constructor and Description |
---|
Entropy()
Create a new instance of Entropy.
|
Entropy(java.lang.String thisValueType)
Create a new instance of Entropy.
|
Modifier and Type | Method and Description |
---|---|
ReplySet |
evaluate(MetricDataset dataset)
Evaluate the comparison of a list of values for the same element and return the result.
|
protected void |
initialise()
Initialise the function values, setting the config parameters or other.
|
Function |
newInstance()
Create and return a new instance of the function, initialised with this function's
value type
valueType and mathOperation evaluator mathCompare . |
checkValueType, createFunction, createFunction, createFunction, getConfigParams, innerObject, isLegalNumber, setConfigParams, setEvaluator, setValueType
public Entropy() throws java.lang.Exception
java.lang.Exception
- any error.public Entropy(java.lang.String thisValueType) throws java.lang.Exception
thisValueType
- the type of object being evaluated.java.lang.Exception
- any error.protected void initialise() throws java.lang.Exception
initialise
in class Function
java.lang.Exception
- any error.public ReplySet evaluate(MetricDataset dataset) throws java.lang.Exception
evaluate
in interface FunctionDef
evaluate
in class Function
dataset
- value dataset. This should store the list of separate data points.
Each point represents a different value for the same entity, where the MetricValue
name can be null and the value is its number of occurrences (integer).java.lang.Exception
- any error.public Function newInstance() throws java.lang.Exception
valueType
and mathOperation evaluator mathCompare
.java.lang.Exception
- any error.