public class Evaluation extends Object implements Summarizable, RevisionHandler
public static void main(String [] args) {
runClassifier(new FunkyClassifier(), args);
}
------------------------------------------------------------------
Example usage from within an application:
Instances trainInstances = ... instances got from somewhere
Instances testInstances = ... instances got from somewhere
Classifier scheme = ... scheme got from somewhere
Evaluation evaluation = new Evaluation(trainInstances);
evaluation.evaluateModel(scheme, testInstances);
System.out.println(evaluation.toSummaryString());
Modifier and Type | Field and Description |
---|---|
protected static int |
k_MarginResolution
Resolution of the margin histogram
|
protected boolean |
m_ClassIsNominal
Is the class nominal or numeric?
|
protected String[] |
m_ClassNames
The names of the classes.
|
protected double[] |
m_ClassPriors
The prior probabilities of the classes
|
protected double |
m_ClassPriorsSum
The sum of counts for priors
|
protected double[][] |
m_ConfusionMatrix
Array for storing the confusion matrix.
|
protected double |
m_Correct
The weight of all correctly classified instances.
|
protected CostMatrix |
m_CostMatrix
The cost matrix (if given).
|
protected Estimator |
m_ErrorEstimator
Numeric class error estimator for scheme
|
protected double |
m_Incorrect
The weight of all incorrectly classified instances.
|
protected double[] |
m_MarginCounts
Cumulative margin distribution
|
protected double |
m_MissingClass
The weight of all instances that had no class assigned to them.
|
protected boolean |
m_NoPriors
enables/disables the use of priors, e.g., if no training set is
present in case of de-serialized schemes
|
protected int |
m_NumClasses
The number of classes.
|
protected int |
m_NumFolds
The number of folds for a cross-validation.
|
protected int |
m_NumTrainClassVals
Number of non-missing class training instances seen
|
protected Estimator |
m_PriorErrorEstimator
Numeric class error estimator for prior
|
protected double |
m_SumAbsErr
Sum of absolute errors.
|
protected double |
m_SumClass
Sum of class values.
|
protected double |
m_SumClassPredicted
Sum of predicted * class values.
|
protected double |
m_SumErr
Sum of errors.
|
protected double |
m_SumKBInfo
Total Kononenko & Bratko Information
|
protected double |
m_SumPredicted
Sum of predicted values.
|
protected double |
m_SumPriorAbsErr
Sum of absolute errors of the prior
|
protected double |
m_SumPriorEntropy
Total entropy of prior predictions
|
protected double |
m_SumPriorSqrErr
Sum of absolute errors of the prior
|
protected double |
m_SumSchemeEntropy
Total entropy of scheme predictions
|
protected double |
m_SumSqrClass
Sum of squared class values.
|
protected double |
m_SumSqrErr
Sum of squared errors.
|
protected double |
m_SumSqrPredicted
Sum of squared predicted values.
|
protected double |
m_TotalCost
The total cost of predictions (includes instance weights)
|
protected double[] |
m_TrainClassVals
Array containing all numeric training class values seen
|
protected double[] |
m_TrainClassWeights
Array containing all numeric training class weights
|
protected double |
m_Unclassified
The weight of all unclassified instances.
|
protected double |
m_WithClass
The weight of all instances that had a class assigned to them.
|
protected static double |
MIN_SF_PROB
The minimum probablility accepted from an estimator to avoid
taking log(0) in Sf calculations.
|
Constructor and Description |
---|
Evaluation(Instances data)
Initializes all the counters for the evaluation.
|
Evaluation(Instances data,
CostMatrix costMatrix)
Initializes all the counters for the evaluation and also takes a
cost matrix as parameter.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addNumericTrainClass(double classValue,
double weight)
Adds a numeric (non-missing) training class value and weight to
the buffer of stored values.
|
double |
areaUnderROC(int classIndex)
Returns the area under ROC for those predictions that have been collected
in the evaluateClassifier(Classifier, Instances) method.
|
protected static String |
attributeValuesString(Instance instance,
Range attRange)
Builds a string listing the attribute values in a specified range of indices,
separated by commas and enclosed in brackets.
|
double |
avgCost()
Gets the average cost, that is, total cost of misclassifications
(incorrect plus unclassified) over the total number of instances.
|
double[][] |
confusionMatrix()
Returns a copy of the confusion matrix.
|
double |
correct()
Gets the number of instances correctly classified (that is, for
which a correct prediction was made).
|
double |
correlationCoefficient()
Returns the correlation coefficient if the class is numeric.
|
void |
crossValidateModel(Classifier classifier,
Instances data,
int numFolds,
Random random,
Object... forPredictionsPrinting)
Performs a (stratified if class is nominal) cross-validation
for a classifier on a set of instances.
|
void |
crossValidateModel(String classifierString,
Instances data,
int numFolds,
String[] options,
Random random)
Performs a (stratified if class is nominal) cross-validation
for a classifier on a set of instances.
|
boolean |
equals(Object obj)
Tests whether the current evaluation object is equal to another
evaluation object
|
double |
errorRate()
Returns the estimated error rate or the root mean squared error
(if the class is numeric).
|
double[] |
evaluateModel(Classifier classifier,
Instances data,
Object... forPredictionsPrinting)
Evaluates the classifier on a given set of instances.
|
static String |
evaluateModel(Classifier classifier,
String[] options)
Evaluates a classifier with the options given in an array of
strings.
|
static String |
evaluateModel(String classifierString,
String[] options)
Evaluates a classifier with the options given in an array of
strings.
|
double |
evaluateModelOnce(Classifier classifier,
Instance instance)
Evaluates the classifier on a single instance.
|
double |
evaluateModelOnce(double[] dist,
Instance instance)
Evaluates the supplied distribution on a single instance.
|
void |
evaluateModelOnce(double prediction,
Instance instance)
Evaluates the supplied prediction on a single instance.
|
double |
evaluateModelOnceAndRecordPrediction(Classifier classifier,
Instance instance)
Evaluates the classifier on a single instance and records the
prediction (if the class is nominal).
|
double |
evaluateModelOnceAndRecordPrediction(double[] dist,
Instance instance)
Evaluates the supplied distribution on a single instance.
|
double |
falseNegativeRate(int classIndex)
Calculate the false negative rate with respect to a particular class.
|
double |
falsePositiveRate(int classIndex)
Calculate the false positive rate with respect to a particular class.
|
double |
fMeasure(int classIndex)
Calculate the F-Measure with respect to a particular class.
|
double[] |
getClassPriors()
Get the current weighted class counts
|
protected static String |
getGlobalInfo(Classifier classifier)
Return the global info (if it exists) for the supplied classifier
|
String |
getRevision()
Returns the revision string.
|
protected static CostMatrix |
handleCostOption(String costFileName,
int numClasses)
Attempts to load a cost matrix.
|
double |
incorrect()
Gets the number of instances incorrectly classified (that is, for
which an incorrect prediction was made).
|
double |
kappa()
Returns value of kappa statistic if class is nominal.
|
double |
KBInformation()
Return the total Kononenko & Bratko Information score in bits
|
double |
KBMeanInformation()
Return the Kononenko & Bratko Information score in bits per
instance.
|
double |
KBRelativeInformation()
Return the Kononenko & Bratko Relative Information score
|
static void |
main(String[] args)
A test method for this class.
|
protected double[] |
makeDistribution(double predictedClass)
Convert a single prediction into a probability distribution
with all zero probabilities except the predicted value which
has probability 1.0;
|
protected static String |
makeOptionString(Classifier classifier,
boolean globalInfo)
Make up the help string giving all the command line options
|
double |
meanAbsoluteError()
Returns the mean absolute error.
|
double |
meanPriorAbsoluteError()
Returns the mean absolute error of the prior.
|
protected String |
num2ShortID(int num,
char[] IDChars,
int IDWidth)
Method for generating indices for the confusion matrix.
|
double |
numFalseNegatives(int classIndex)
Calculate number of false negatives with respect to a particular class.
|
double |
numFalsePositives(int classIndex)
Calculate number of false positives with respect to a particular class.
|
double |
numInstances()
Gets the number of test instances that had a known class value
(actually the sum of the weights of test instances with known
class value).
|
double |
numTrueNegatives(int classIndex)
Calculate the number of true negatives with respect to a particular class.
|
double |
numTruePositives(int classIndex)
Calculate the number of true positives with respect to a particular class.
|
double |
pctCorrect()
Gets the percentage of instances correctly classified (that is, for
which a correct prediction was made).
|
double |
pctIncorrect()
Gets the percentage of instances incorrectly classified (that is, for
which an incorrect prediction was made).
|
double |
pctUnclassified()
Gets the percentage of instances not classified (that is, for
which no prediction was made by the classifier).
|
double |
precision(int classIndex)
Calculate the precision with respect to a particular class.
|
FastVector |
predictions()
Returns the predictions that have been collected.
|
protected static String |
predictionText(Classifier classifier,
Instance inst,
int instNum,
Range attributesToOutput,
boolean printDistribution)
store the prediction made by the classifier as a string
|
static void |
printClassifications(Classifier classifier,
Instances train,
ConverterUtils.DataSource testSource,
int classIndex,
Range attributesToOutput,
boolean printDistribution,
StringBuffer text)
Prints the predictions for the given dataset into a supplied StringBuffer
|
static void |
printClassifications(Classifier classifier,
Instances train,
ConverterUtils.DataSource testSource,
int classIndex,
Range attributesToOutput,
StringBuffer predsText)
Prints the predictions for the given dataset into a String variable.
|
protected static void |
printClassificationsHeader(Instances test,
Range attributesToOutput,
boolean printDistribution,
StringBuffer text)
Prints the header for the predictions output into a supplied StringBuffer
|
double |
priorEntropy()
Calculate the entropy of the prior distribution
|
double |
recall(int classIndex)
Calculate the recall with respect to a particular class.
|
double |
relativeAbsoluteError()
Returns the relative absolute error.
|
double |
rootMeanPriorSquaredError()
Returns the root mean prior squared error.
|
double |
rootMeanSquaredError()
Returns the root mean squared error.
|
double |
rootRelativeSquaredError()
Returns the root relative squared error if the class is numeric.
|
protected void |
setNumericPriorsFromBuffer()
Sets up the priors for numeric class attributes from the
training class values that have been seen so far.
|
void |
setPriors(Instances train)
Sets the class prior probabilities
|
double |
SFEntropyGain()
Returns the total SF, which is the null model entropy minus
the scheme entropy.
|
double |
SFMeanEntropyGain()
Returns the SF per instance, which is the null model entropy
minus the scheme entropy, per instance.
|
double |
SFMeanPriorEntropy()
Returns the entropy per instance for the null model
|
double |
SFMeanSchemeEntropy()
Returns the entropy per instance for the scheme
|
double |
SFPriorEntropy()
Returns the total entropy for the null model
|
double |
SFSchemeEntropy()
Returns the total entropy for the scheme
|
String |
toClassDetailsString()
Generates a breakdown of the accuracy for each class (with default title),
incorporating various information-retrieval statistics, such as
true/false positive rate, precision/recall/F-Measure.
|
String |
toClassDetailsString(String title)
Generates a breakdown of the accuracy for each class,
incorporating various information-retrieval statistics, such as
true/false positive rate, precision/recall/F-Measure.
|
String |
toCumulativeMarginDistributionString()
Output the cumulative margin distribution as a string suitable
for input for gnuplot or similar package.
|
String |
toMatrixString()
Calls toMatrixString() with a default title.
|
String |
toMatrixString(String title)
Outputs the performance statistics as a classification confusion
matrix.
|
String |
toSummaryString()
Calls toSummaryString() with no title and no complexity stats
|
String |
toSummaryString(boolean printComplexityStatistics)
Calls toSummaryString() with a default title.
|
String |
toSummaryString(String title,
boolean printComplexityStatistics)
Outputs the performance statistics in summary form.
|
double |
totalCost()
Gets the total cost, that is, the cost of each prediction times the
weight of the instance, summed over all instances.
|
double |
trueNegativeRate(int classIndex)
Calculate the true negative rate with respect to a particular class.
|
double |
truePositiveRate(int classIndex)
Calculate the true positive rate with respect to a particular class.
|
double |
unclassified()
Gets the number of instances not classified (that is, for
which no prediction was made by the classifier).
|
protected void |
updateMargins(double[] predictedDistribution,
int actualClass,
double weight)
Update the cumulative record of classification margins
|
protected void |
updateNumericScores(double[] predicted,
double[] actual,
double weight)
Update the numeric accuracy measures.
|
void |
updatePriors(Instance instance)
Updates the class prior probabilities (when incrementally
training)
|
protected void |
updateStatsForClassifier(double[] predictedDistribution,
Instance instance)
Updates all the statistics about a classifiers performance for
the current test instance.
|
protected void |
updateStatsForPredictor(double predictedValue,
Instance instance)
Updates all the statistics about a predictors performance for
the current test instance.
|
void |
useNoPriors()
disables the use of priors, e.g., in case of de-serialized schemes
that have no access to the original training set, but are evaluated
on a set set.
|
double |
weightedAreaUnderROC()
Calculates the weighted (by class size) AUC.
|
double |
weightedFalseNegativeRate()
Calculates the weighted (by class size) false negative rate.
|
double |
weightedFalsePositiveRate()
Calculates the weighted (by class size) false positive rate.
|
double |
weightedFMeasure()
Calculates the weighted (by class size) F-Measure.
|
double |
weightedPrecision()
Calculates the weighted (by class size) false precision.
|
double |
weightedRecall()
Calculates the weighted (by class size) recall.
|
double |
weightedTrueNegativeRate()
Calculates the weighted (by class size) true negative rate.
|
double |
weightedTruePositiveRate()
Calculates the weighted (by class size) true positive rate.
|
static String |
wekaStaticWrapper(Sourcable classifier,
String className)
Wraps a static classifier in enough source to test using the weka
class libraries.
|
protected int m_NumClasses
protected int m_NumFolds
protected double m_Incorrect
protected double m_Correct
protected double m_Unclassified
protected double m_MissingClass
protected double m_WithClass
protected double[][] m_ConfusionMatrix
protected String[] m_ClassNames
protected boolean m_ClassIsNominal
protected double[] m_ClassPriors
protected double m_ClassPriorsSum
protected CostMatrix m_CostMatrix
protected double m_TotalCost
protected double m_SumErr
protected double m_SumAbsErr
protected double m_SumSqrErr
protected double m_SumClass
protected double m_SumSqrClass
protected double m_SumPredicted
protected double m_SumSqrPredicted
protected double m_SumClassPredicted
protected double m_SumPriorAbsErr
protected double m_SumPriorSqrErr
protected double m_SumKBInfo
protected static int k_MarginResolution
protected double[] m_MarginCounts
protected int m_NumTrainClassVals
protected double[] m_TrainClassVals
protected double[] m_TrainClassWeights
protected Estimator m_PriorErrorEstimator
protected Estimator m_ErrorEstimator
protected static final double MIN_SF_PROB
protected double m_SumPriorEntropy
protected double m_SumSchemeEntropy
protected boolean m_NoPriors
public Evaluation(Instances data) throws Exception
useNoPriors()
if the dataset is the test set and you
can't initialize with the priors from the training set via
setPriors(Instances)
.data
- set of training instances, to get some header
information and prior class distribution informationException
- if the class is not defineduseNoPriors()
,
setPriors(Instances)
public Evaluation(Instances data, CostMatrix costMatrix) throws Exception
useNoPriors()
if the dataset is the test set and you
can't initialize with the priors from the training set via
setPriors(Instances)
.data
- set of training instances, to get some header
information and prior class distribution informationcostMatrix
- the cost matrix---if null, default costs will be usedException
- if cost matrix is not compatible with
data, the class is not defined or the class is numericuseNoPriors()
,
setPriors(Instances)
public double areaUnderROC(int classIndex)
classIndex
- the index of the class to consider as "positive"public double weightedAreaUnderROC()
public double[][] confusionMatrix()
public void crossValidateModel(Classifier classifier, Instances data, int numFolds, Random random, Object... forPredictionsPrinting) throws Exception
classifier
- the classifier with any options set.data
- the data on which the cross-validation is to be
performednumFolds
- the number of folds for the cross-validationrandom
- random number generator for randomizationforPredictionsString
- varargs parameter that, if supplied, is
expected to hold a StringBuffer to print predictions to,
a Range of attributes to output and a Boolean (true if the distribution
is to be printed)Exception
- if a classifier could not be generated
successfully or the class is not definedpublic void crossValidateModel(String classifierString, Instances data, int numFolds, String[] options, Random random) throws Exception
classifierString
- a string naming the class of the classifierdata
- the data on which the cross-validation is to be
performednumFolds
- the number of folds for the cross-validationoptions
- the options to the classifier. Any optionsrandom
- the random number generator for randomizing the data
accepted by the classifier will be removed from this array.Exception
- if a classifier could not be generated
successfully or the class is not definedpublic static String evaluateModel(String classifierString, String[] options) throws Exception
classifierString
- class of machine learning classifier as a stringoptions
- the array of string containing the optionsException
- if model could not be evaluated successfullypublic static void main(String[] args)
args
- an array of command line arguments, the first of which
must be the class name of a classifier.public static String evaluateModel(Classifier classifier, String[] options) throws Exception
classifier
- machine learning classifieroptions
- the array of string containing the optionsException
- if model could not be evaluated successfullyprotected static CostMatrix handleCostOption(String costFileName, int numClasses) throws Exception
costFileName
- the filename of the cost matrixnumClasses
- the number of classes that should be in the cost matrix
(only used if the cost file is in old format).CostMatrix
value, or null if costFileName is emptyException
- if an error occurs.public double[] evaluateModel(Classifier classifier, Instances data, Object... forPredictionsPrinting) throws Exception
classifier
- machine learning classifierdata
- set of test instances for evaluationforPredictionsString
- varargs parameter that, if supplied, is
expected to hold a StringBuffer to print predictions to,
a Range of attributes to output and a Boolean (true if the distribution
is to be printed)Exception
- if model could not be evaluated
successfullypublic double evaluateModelOnceAndRecordPrediction(Classifier classifier, Instance instance) throws Exception
classifier
- machine learning classifierinstance
- the test instance to be classifiedException
- if model could not be evaluated
successfully or the data contains string attributespublic double evaluateModelOnce(Classifier classifier, Instance instance) throws Exception
classifier
- machine learning classifierinstance
- the test instance to be classifiedException
- if model could not be evaluated
successfully or the data contains string attributespublic double evaluateModelOnce(double[] dist, Instance instance) throws Exception
dist
- the supplied distributioninstance
- the test instance to be classifiedException
- if model could not be evaluated
successfullypublic double evaluateModelOnceAndRecordPrediction(double[] dist, Instance instance) throws Exception
dist
- the supplied distributioninstance
- the test instance to be classifiedException
- if model could not be evaluated
successfullypublic void evaluateModelOnce(double prediction, Instance instance) throws Exception
prediction
- the supplied predictioninstance
- the test instance to be classifiedException
- if model could not be evaluated
successfullypublic FastVector predictions()
public static String wekaStaticWrapper(Sourcable classifier, String className) throws Exception
classifier
- a Sourcable ClassifierclassName
- the name to give to the source code classException
- if code-generation failspublic final double numInstances()
public final double incorrect()
public final double pctIncorrect()
public final double totalCost()
public final double avgCost()
public final double correct()
public final double pctCorrect()
public final double unclassified()
public final double pctUnclassified()
public final double errorRate()
public final double kappa()
public final double correlationCoefficient() throws Exception
Exception
- if class is not numericpublic final double meanAbsoluteError()
public final double meanPriorAbsoluteError()
public final double relativeAbsoluteError() throws Exception
Exception
- if it can't be computedpublic final double rootMeanSquaredError()
public final double rootMeanPriorSquaredError()
public final double rootRelativeSquaredError()
public final double priorEntropy() throws Exception
Exception
- if the class is not nominalpublic final double KBInformation() throws Exception
Exception
- if the class is not nominalpublic final double KBMeanInformation() throws Exception
Exception
- if the class is not nominalpublic final double KBRelativeInformation() throws Exception
Exception
- if the class is not nominalpublic final double SFPriorEntropy()
public final double SFMeanPriorEntropy()
public final double SFSchemeEntropy()
public final double SFMeanSchemeEntropy()
public final double SFEntropyGain()
public final double SFMeanEntropyGain()
public String toCumulativeMarginDistributionString() throws Exception
Exception
- if the class attribute is nominalpublic String toSummaryString()
toSummaryString
in interface Summarizable
public String toSummaryString(boolean printComplexityStatistics)
printComplexityStatistics
- if true, complexity statistics are
returned as wellpublic String toSummaryString(String title, boolean printComplexityStatistics)
title
- the title for the statisticsprintComplexityStatistics
- if true, complexity statistics are
returned as wellpublic String toMatrixString() throws Exception
Exception
- if the class is numericpublic String toMatrixString(String title) throws Exception
title
- the title for the confusion matrixException
- if the class is numericpublic String toClassDetailsString() throws Exception
Exception
- if class is not nominalpublic String toClassDetailsString(String title) throws Exception
title
- the title to prepend the stats string withException
- if class is not nominalpublic double numTruePositives(int classIndex)
correctly classified positives
classIndex
- the index of the class to consider as "positive"public double truePositiveRate(int classIndex)
correctly classified positives ------------------------------ total positives
classIndex
- the index of the class to consider as "positive"public double weightedTruePositiveRate()
public double numTrueNegatives(int classIndex)
correctly classified negatives
classIndex
- the index of the class to consider as "positive"public double trueNegativeRate(int classIndex)
correctly classified negatives ------------------------------ total negatives
classIndex
- the index of the class to consider as "positive"public double weightedTrueNegativeRate()
public double numFalsePositives(int classIndex)
incorrectly classified negatives
classIndex
- the index of the class to consider as "positive"public double falsePositiveRate(int classIndex)
incorrectly classified negatives -------------------------------- total negatives
classIndex
- the index of the class to consider as "positive"public double weightedFalsePositiveRate()
public double numFalseNegatives(int classIndex)
incorrectly classified positives
classIndex
- the index of the class to consider as "positive"public double falseNegativeRate(int classIndex)
incorrectly classified positives -------------------------------- total positives
classIndex
- the index of the class to consider as "positive"public double weightedFalseNegativeRate()
public double recall(int classIndex)
correctly classified positives ------------------------------ total positives(Which is also the same as the truePositiveRate.)
classIndex
- the index of the class to consider as "positive"public double weightedRecall()
public double precision(int classIndex)
correctly classified positives ------------------------------ total predicted as positive
classIndex
- the index of the class to consider as "positive"public double weightedPrecision()
public double fMeasure(int classIndex)
2 * recall * precision ---------------------- recall + precision
classIndex
- the index of the class to consider as "positive"public double weightedFMeasure()
public void setPriors(Instances train) throws Exception
train
- the training instances used to determine
the prior probabilitiesException
- if the class attribute of the instances is not
setpublic double[] getClassPriors()
public void updatePriors(Instance instance) throws Exception
instance
- the new training instance seenException
- if the class of the instance is not
setpublic void useNoPriors()
public boolean equals(Object obj)
public static void printClassifications(Classifier classifier, Instances train, ConverterUtils.DataSource testSource, int classIndex, Range attributesToOutput, StringBuffer predsText) throws Exception
classifier
- the classifier to usetrain
- the training datatestSource
- the test setclassIndex
- the class index (1-based), if -1 ot does not
override the class index is stored in the data
file (by using the last attribute)attributesToOutput
- the indices of the attributes to outputException
- if test file cannot be openedprotected static void printClassificationsHeader(Instances test, Range attributesToOutput, boolean printDistribution, StringBuffer text)
test
- structure of the test set to print predictions forattributesToOutput
- indices of the attributes to outputprintDistribution
- prints the complete distribution for nominal
attributes, not just the predicted valuetext
- the StringBuffer to print topublic static void printClassifications(Classifier classifier, Instances train, ConverterUtils.DataSource testSource, int classIndex, Range attributesToOutput, boolean printDistribution, StringBuffer text) throws Exception
classifier
- the classifier to usetrain
- the training datatestSource
- the test setclassIndex
- the class index (1-based), if -1 ot does not
override the class index is stored in the data
file (by using the last attribute)attributesToOutput
- the indices of the attributes to outputprintDistribution
- prints the complete distribution for nominal
classes, not just the predicted valuetext
- StringBuffer to hold the printed predictionsException
- if test file cannot be openedprotected static String predictionText(Classifier classifier, Instance inst, int instNum, Range attributesToOutput, boolean printDistribution) throws Exception
classifier
- the classifier to useinst
- the instance to generate text frominstNum
- the index in the datasetattributesToOutput
- the indices of the attributes to outputprintDistribution
- prints the complete distribution for nominal
classes, not just the predicted valueException
- if something goes wrong#printClassifications(Classifier, Instances, String, int, Range, boolean)
protected static String attributeValuesString(Instance instance, Range attRange)
instance
- the instance to print the values fromattRange
- the range of the attributes to listprotected static String makeOptionString(Classifier classifier, boolean globalInfo)
classifier
- the classifier to include options forglobalInfo
- include the global information string
for the classifier (if available).protected static String getGlobalInfo(Classifier classifier) throws Exception
classifier
- the classifier to get the global info forException
- if there is a problem reflecting on the classifierprotected String num2ShortID(int num, char[] IDChars, int IDWidth)
num
- integer to formatIDChars
- the characters to useIDWidth
- the width of the entryprotected double[] makeDistribution(double predictedClass)
predictedClass
- the index of the predicted classprotected void updateStatsForClassifier(double[] predictedDistribution, Instance instance) throws Exception
predictedDistribution
- the probabilities assigned to
each classinstance
- the instance to be classifiedException
- if the class of the instance is not
setprotected void updateStatsForPredictor(double predictedValue, Instance instance) throws Exception
predictedValue
- the numeric value the classifier predictsinstance
- the instance to be classifiedException
- if the class of the instance is not
setprotected void updateMargins(double[] predictedDistribution, int actualClass, double weight)
predictedDistribution
- the probability distribution predicted for
the current instanceactualClass
- the index of the actual instance classweight
- the weight assigned to the instanceprotected void updateNumericScores(double[] predicted, double[] actual, double weight)
predicted
- the predicted valuesactual
- the actual valueweight
- the weight associated with this predictionprotected void addNumericTrainClass(double classValue, double weight)
classValue
- the class valueweight
- the instance weightprotected void setNumericPriorsFromBuffer()
public String getRevision()
getRevision
in interface RevisionHandler
Copyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.