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.InformationRetrievalEvaluationMetricSø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 booleanappliesToNominalClass()Return true if this evaluation metric can be computed when the class is nominalbooleanappliesToNumericClass()Return true if this evaluation metric can be computed when the class is numericdoublegetClassWeightedAverageStatistic(String statName)Get the weighted (by class) average for this statistic.StringgetMetricDescription()Get a short description of this metric (algorithm, forumulas etc.).StringgetMetricName()Get the name of this metricdoublegetStatistic(String statName)Get the value of the named statistic - for the first class label.doublegetStatistic(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.StringtoSummaryString()Return a formatted string (suitable for displaying in console or GUI output) containing all the statistics that this metric computes.voidupdateStatsForClassifier(double[] predictedDistribution, weka.core.Instance instance)Updates the statistics about a classifiers performance for the current test instance.voidupdateStatsForPredictor(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:
getMetricNamein 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:
getMetricDescriptionin 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:
appliesToNominalClassin 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:
appliesToNumericClassin 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:
getStatisticNamesin 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:
getStatisticin 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:
getStatisticin 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:
getClassWeightedAverageStatisticin 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:
toSummaryStringin interfaceweka.classifiers.evaluation.StandardEvaluationMetric- Returns:
- a formatted string containing all the computed statistics
-
updateStatsForClassifier
public void updateStatsForClassifier(double[] predictedDistribution, weka.core.Instance instance) throws ExceptionUpdates 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:
updateStatsForClassifierin interfaceweka.classifiers.evaluation.InformationRetrievalEvaluationMetric- Specified by:
updateStatsForClassifierin 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 ExceptionUpdates 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:
updateStatsForPredictorin 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
-
-