Package weka.classifiers.evaluation
Class Dice
- java.lang.Object
-
- weka.classifiers.evaluation.AbstractEvaluationMetric
-
- weka.classifiers.evaluation.Dice
-
- All Implemented Interfaces:
Serializable
,weka.classifiers.evaluation.InformationRetrievalEvaluationMetric
,weka.classifiers.evaluation.StandardEvaluationMetric
public class Dice extends weka.classifiers.evaluation.AbstractEvaluationMetric implements weka.classifiers.evaluation.StandardEvaluationMetric, weka.classifiers.evaluation.InformationRetrievalEvaluationMetric
Sørensen–Dice coefficient: https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Dice()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
appliesToNominalClass()
Return true if this evaluation metric can be computed when the class is nominalboolean
appliesToNumericClass()
Return true if this evaluation metric can be computed when the class is numericdouble
getClassWeightedAverageStatistic(String statName)
Get the weighted (by class) average for this statistic.String
getMetricDescription()
Get a short description of this metric (algorithm, forumulas etc.).String
getMetricName()
Get the name of this metricdouble
getStatistic(String statName)
Get the value of the named statistic - for the first class label.double
getStatistic(String statName, int classIndex)
Get the value of the named statistic for the given class index.List<String>
getStatisticNames()
Get a list of the names of the statistics that this metrics computes.String
toSummaryString()
Return a formatted string (suitable for displaying in console or GUI output) containing all the statistics that this metric computes.void
updateStatsForClassifier(double[] predictedDistribution, weka.core.Instance instance)
Updates the statistics about a classifiers performance for the current test instance.void
updateStatsForPredictor(double predictedValue, weka.core.Instance instance)
Updates the statistics about a predictors performance for the current test instance.
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getMetricName
public String getMetricName()
Get the name of this metric- Specified by:
getMetricName
in classweka.classifiers.evaluation.AbstractEvaluationMetric
- Returns:
- the name of this metric
-
getMetricDescription
public String getMetricDescription()
Get a short description of this metric (algorithm, forumulas etc.).- Specified by:
getMetricDescription
in classweka.classifiers.evaluation.AbstractEvaluationMetric
- Returns:
- a short description of this metric
-
appliesToNominalClass
public boolean appliesToNominalClass()
Return true if this evaluation metric can be computed when the class is nominal- Specified by:
appliesToNominalClass
in classweka.classifiers.evaluation.AbstractEvaluationMetric
- Returns:
- true if this evaluation metric can be computed when the class is nominal
-
appliesToNumericClass
public boolean appliesToNumericClass()
Return true if this evaluation metric can be computed when the class is numeric- Specified by:
appliesToNumericClass
in classweka.classifiers.evaluation.AbstractEvaluationMetric
- Returns:
- true if this evaluation metric can be computed when the class is numeric
-
getStatisticNames
public List<String> getStatisticNames()
Get a list of the names of the statistics that this metrics computes. E.g. an information theoretic evaluation measure might compute total number of bits as well as average bits/instance- Specified by:
getStatisticNames
in classweka.classifiers.evaluation.AbstractEvaluationMetric
- Returns:
- the names of the statistics that this metric computes
-
getStatistic
public double getStatistic(String statName)
Get the value of the named statistic - for the first class label.- Specified by:
getStatistic
in classweka.classifiers.evaluation.AbstractEvaluationMetric
- Parameters:
statName
- the name of the statistic to compute the value for- Returns:
- the computed statistic or Utils.missingValue() if the statistic can't be computed for some reason
- See Also:
getStatistic(String, int)
-
getStatistic
public double getStatistic(String statName, int classIndex)
Get the value of the named statistic for the given class index.If the implementing class is extending AbstractEvaluationMetric then the implementation of getStatistic(String statName) should just call this method with a classIndex of 0.
- Specified by:
getStatistic
in interfaceweka.classifiers.evaluation.InformationRetrievalEvaluationMetric
- Parameters:
statName
- the name of the statistic to compute the value forclassIndex
- the class index for which to compute the statistic- Returns:
- the value of the named statistic for the given class index or Utils.missingValue() if the statistic can't be computed for some reason
-
getClassWeightedAverageStatistic
public double getClassWeightedAverageStatistic(String statName)
Get the weighted (by class) average for this statistic.- Specified by:
getClassWeightedAverageStatistic
in interfaceweka.classifiers.evaluation.InformationRetrievalEvaluationMetric
- Parameters:
statName
- the name of the statistic to compute- Returns:
- the weighted (by class) average value of the statistic or Utils.missingValue() if this can't be computed (or isn't appropriate).
-
toSummaryString
public String toSummaryString()
Return a formatted string (suitable for displaying in console or GUI output) containing all the statistics that this metric computes.- Specified by:
toSummaryString
in interfaceweka.classifiers.evaluation.StandardEvaluationMetric
- Returns:
- a formatted string containing all the computed statistics
-
updateStatsForClassifier
public void updateStatsForClassifier(double[] predictedDistribution, weka.core.Instance instance) throws Exception
Updates the statistics about a classifiers performance for the current test instance. Gets called when the class is nominal. Implementers need only implement this method if it is not possible to compute their statistics from what is stored in the base Evaluation object.- Specified by:
updateStatsForClassifier
in interfaceweka.classifiers.evaluation.InformationRetrievalEvaluationMetric
- Specified by:
updateStatsForClassifier
in interfaceweka.classifiers.evaluation.StandardEvaluationMetric
- Parameters:
predictedDistribution
- the probabilities assigned to each classinstance
- the instance to be classified- Throws:
Exception
- if the class of the instance is not set
-
updateStatsForPredictor
public void updateStatsForPredictor(double predictedValue, weka.core.Instance instance) throws Exception
Updates the statistics about a predictors performance for the current test instance. Gets called when the class is numeric. Implementers need only implement this method if it is not possible to compute their statistics from what is stored in the base Evaluation object.- Specified by:
updateStatsForPredictor
in interfaceweka.classifiers.evaluation.StandardEvaluationMetric
- Parameters:
predictedValue
- the numeric value the classifier predictsinstance
- the instance to be classified- Throws:
Exception
- if the class of the instance is not set
-
-