public abstract class BaseStatistics extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable, Printable, Options, Commandable, Savable
Implementations of this case need to supply evaluate(magpie.data.Dataset),
which actually performs the statistical calculations. Make sure to store the
measurements and predicted class variables! It is also up to the implementation
to provide some way of storing results and printing them using the toString() operation.
Usage: *No options to set*
Implemented Commands:
evaluate $<dataset> - Evaluate measured vs. predicted class of entries
Implemented Print Commands:
stats - Print out all statistics roc - Print out Receiver Operating Characteristic curve baseline - Print statistics about the training data
Implemented Save Commands
data - Save predicted and measured class values used to compute
statistics
| Modifier and Type | Field and Description |
|---|---|
protected double[] |
Measured
Measured value of class variable
|
int |
NumberTested
Number of entries evaluated
|
protected double[] |
Predicted
Predicted value of class variable
|
double[][] |
ROC
Receiver operating characteristic curve
|
double |
ROC_AUC
Area under receiver operating characteristic curve normalized such that 1.0
is a perfect classifier and 0.0 is a perfectly-random classifier.
|
| Constructor and Description |
|---|
BaseStatistics() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
about()
Prints a simple status message about this object
|
java.lang.Object |
clone() |
protected abstract void |
evaluate_protected(Dataset results)
Internal method for acutally computing results.
|
void |
evaluate(Dataset results)
Generates statistics about the performance on a model.
|
protected void |
getROCCurve(int[] measured,
double[] score,
int maxSteps)
Generate the receiver operating characteristic curve based on the measured
and score variables for many instances.
|
abstract java.util.Map<java.lang.String,java.lang.Double> |
getStatistics()
Retrieve list of statistics stored in this class.
|
java.util.Map<java.lang.String,java.lang.Double> |
getStatisticsNoNaNs()
Get statistics, except for values that are NaNs or infinite
|
abstract java.lang.String |
printBaselineStats()
Print statistics about the measured class values.
|
java.lang.String |
printCommand(java.util.List<java.lang.String> Command)
Handles more complicated printing commands.
|
java.lang.String |
printDescription(boolean htmlFormat)
Print full name of object, and a simple description of the options.
|
java.lang.String |
printROCCurve()
Print the ROC Curve as a plottable string.
|
java.lang.String |
printUsage()
Print out required format for options.
|
java.lang.Object |
runCommand(java.util.List<java.lang.Object> Command)
Process some command described by a list of Objects.
|
java.lang.String |
saveCommand(java.lang.String Basename,
java.lang.String Format)
Handles complicated saving commands.
|
void |
savePerformanceData(java.lang.String filename)
Write out measured and predicted class variables used to compute statistics.
|
void |
setOptions(java.util.List<java.lang.Object> Options)
Set any options for this object.
|
public int NumberTested
public double[][] ROC
public double ROC_AUC
protected double[] Measured
protected double[] Predicted
public void setOptions(java.util.List<java.lang.Object> Options)
throws java.lang.Exception
OptionssetOptions in interface OptionsOptions - Array of options as Objects - can be nulljava.lang.Exception - if problem with inputspublic java.lang.String printUsage()
OptionsprintUsage in interface Optionspublic java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic final void evaluate(Dataset results)
results - Dataset containing both measured and predicted classes.protected abstract void evaluate_protected(Dataset results)
results - Dataset to be evaluatedprotected void getROCCurve(int[] measured,
double[] score,
int maxSteps)
measured - Measured class variablescore - Classification score. Higher score means 'more likely to be positive class'maxSteps - Number of steps in curvepublic java.lang.String printROCCurve()
public java.lang.String about()
Printablepublic java.lang.String printDescription(boolean htmlFormat)
PrintableExample: For a model training a separate WekaRegression for intermetallics
magpie.models.regression.SplitRegression
printDescription in interface PrintablehtmlFormat - Whether format for output to an HTML page
(e.g., <div> to create indentation) or for printing to screen.#printModel()public abstract java.lang.String printBaselineStats()
public java.lang.String printCommand(java.util.List<java.lang.String> Command)
throws java.lang.Exception
PrintableprintCommand in interface PrintableCommand - Command specifying what to printjava.lang.Exception - If command not understoodpublic java.lang.Object runCommand(java.util.List<java.lang.Object> Command)
throws java.lang.Exception
CommandablerunCommand in interface CommandableCommand - Command as a list of objectsjava.lang.Exception - If something goes wrongpublic java.lang.String saveCommand(java.lang.String Basename,
java.lang.String Format)
throws java.lang.Exception
SavableDev Note: Make sure to add save format to Javadoc. See Dataset as an example. Required format:
<save><p><b>format<b> - Description
<br>Optional room to talk more about format </save>
saveCommand in interface SavableBasename - Name of file without extensionFormat - Command specifying format in which to printjava.lang.Exception - If command not understoodpublic void savePerformanceData(java.lang.String filename)
throws java.lang.Exception
filename - Name of output filejava.lang.Exceptionpublic abstract java.util.Map<java.lang.String,java.lang.Double> getStatistics()
public java.util.Map<java.lang.String,java.lang.Double> getStatisticsNoNaNs()