|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--shared.CatTestResult
The CatTestResult class provides summaries of running categorizers on test data. This includes the option of loading the test data from a file (or giving an existing InstanceList), running the categorizer on all instances, and storing the results. Information can then be extracted quickly.
The training set and test set (if given as opposed to loading it here) must not be altered as long as calls to this class are being made, because references are kept to those structures.
The complexity for construction of the CatTestResult is O(n1 n2), where n1 is the size of the training-set InstanceList and n2 is the size of the test set. All display routines take time proportional to the number of displayed numbers.
The CatTestResult class has been enhanced to compute the log-evidence metric. The log evidence metric is equal to the total evidence against the correct category.
| Field Summary | |
static int |
Generalized
The Generalized partition for error reporting. |
protected LogOptions |
logOptions
Logging options for this class. |
static int |
Memorized
The Memorized partition for error reporting. |
static int |
Normal
The Normal partition for error reporting. |
| Constructor Summary | |
CatTestResult(Categorizer cat,
InstanceList trainILSource,
InstanceList testILSource)
Constructor. |
|
| Method Summary | |
static void |
check_for_unknown_classes(int step,
int start,
double[][] confusionMatrix)
Determines whether unknown classes are used. |
java.lang.String |
display_ascii_confusion_matrix(java.lang.String stream)
Displays confusion matrices in ascii format for this CatTestResult object. |
static java.lang.String |
display_ascii_confusion_matrix(java.lang.String display,
double[][] confusionMatrix,
Schema schema)
Displays confusion matrices in ascii format. |
java.lang.String |
display_confusion_matrix(java.lang.String stream)
Displays the confusion matrix. |
void |
display(java.io.BufferedWriter stream)
Gives all available statistics (not displays) |
double |
error()
Returns ratio number of test instances incorrectly categorized / number of test instances. |
double |
error(int errType)
Returns ratio number of test instances incorrectly categorized / number of test instances. |
static boolean |
get_compute_log_loss()
Returns TRUE if the log loss option is set, or FALSE otherwise. |
double[][] |
get_confusion_matrix()
Returns the confusion matrix of the results of testing. |
int |
get_log_level()
Returns the logging level for this object. |
LogOptions |
get_log_options()
Returns the LogOptions object for this object. |
java.io.Writer |
get_log_stream()
Returns the stream to which logs for this object are written. |
ScoringMetrics |
get_metrics()
Returns the scoring metrics collected from the test results. |
CatOneTestResult[] |
get_results()
Returns the individual results from testing. |
InstanceList |
get_testing_instance_list()
Returns the InstanceList used for testing. |
InstanceList |
get_training_instance_list()
Returns the InstanceList used for training. |
protected void |
initialize(Categorizer cat)
Initializes this CatTestResult by categorizing the test data set with the given Categorizer. |
protected void |
initializeTrainTable()
Uses TableCategorizer as an interface to hash table to do quick lookup on whether a test instance occurs in the training set. |
double |
normalized_loss()
Calculates a normalized loss value. |
int |
num_correct()
Return the number of instances in the test InstanceList that were correctly categorized. |
int |
num_incorrect()
Return the number of instances in the test InstanceList that were incorrectly categorized. |
int |
num_off_train()
Returns the number of test instances not appearing in appearing in the training data. |
int |
num_on_train()
Returns the number of test instances appearing in appearing in the training data. |
int |
num_test_instances()
Returns the number of instances in the testing set. |
int |
num_train_instances()
Returns the number of instances in the training set. |
static double |
pessimistic_error_correction(double numErrors,
double totalWeight,
double zValue)
Prune the tree for the given pruning factor. |
static void |
set_compute_log_loss(boolean b)
Sets the computation of log loss option. |
void |
set_log_level(int level)
Sets the logging level for this object. |
void |
set_log_options(LogOptions opt)
Sets the LogOptions object for this object. |
void |
set_log_prefixes(java.lang.String file,
int line,
int lvl1,
int lvl2)
Sets the logging message prefix for this object. |
void |
set_log_stream(java.io.Writer strm)
Sets the stream to which logging options are displayed. |
java.lang.String |
toString()
Converts information in this CatTestResult object to a string for display. |
double |
total_correct_weight()
Returns the total weight of instances which were correctly classified. |
double |
total_incorrect_weight()
Returns the total weight of instances which were incorrectly classified. |
double |
total_log_loss()
Returns the total log loss recorded for this Inducer run. |
double |
total_loss()
Returns the total loss value from the scoring metrics. |
double |
total_test_weight()
Returns the total weight in the test list. |
double |
total_train_weight()
Returns the total weight in the training list. |
double |
total_weight_off_train()
Weight of test instances appearing not appearing in the training data. |
double |
total_weight_on_train()
Weight of test instances appearing in appearing in the training data. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static final int Normal
public static final int Generalized
public static final int Memorized
protected LogOptions logOptions
| Constructor Detail |
public CatTestResult(Categorizer cat,
InstanceList trainILSource,
InstanceList testILSource)
cat - The Categorizer used to create this CatTestResult.trainILSource - The training data set.testILSource - The test data set.| Method Detail |
public void set_log_level(int level)
level - The new logging level.public int get_log_level()
public void set_log_stream(java.io.Writer strm)
strm - The stream to which logs will be written.public java.io.Writer get_log_stream()
public LogOptions get_log_options()
public void set_log_options(LogOptions opt)
opt - The new LogOptions object.
public void set_log_prefixes(java.lang.String file,
int line,
int lvl1,
int lvl2)
file - The file name to be displayed in the prefix of log messages.line - The line number to be displayed in the prefix of log messages.lvl1 - The log level of the statement being logged.lvl2 - The level of log messages being displayed.
public static double pessimistic_error_correction(double numErrors,
double totalWeight,
double zValue)
numErrors - The number of errors produced in a test run of this categorizer.totalWeight - The total weight of all Instances tested.zValue - The half of the interval width for confidence evaluation.public double error()
public double error(int errType)
errType - The type of error used to partition test cases. Possible
values are CatTestResult.Normal, CatTestResult.Generalized,
CatTestResult.Memorized.public double total_weight_on_train()
public double total_weight_off_train()
protected void initializeTrainTable()
public double total_test_weight()
public double total_incorrect_weight()
protected void initialize(Categorizer cat)
cat - The categorizer with which the test data set will be categorized.public int num_correct()
public int num_incorrect()
public int num_on_train()
public int num_off_train()
public int num_train_instances()
public int num_test_instances()
public double total_correct_weight()
public double total_train_weight()
public double total_log_loss()
public static void check_for_unknown_classes(int step,
int start,
double[][] confusionMatrix)
step - The step value of where to begin in the
confusion matrix.start - The start value of where to begin in the
confusion matrix.confusionMatrix - The confusion matrix which is being checked
for unknown values.public java.lang.String display_ascii_confusion_matrix(java.lang.String stream)
stream - Stream to which display is shown.
public static java.lang.String display_ascii_confusion_matrix(java.lang.String display,
double[][] confusionMatrix,
Schema schema)
display - The String containing any previous items to be
included in the display.confusionMatrix - The confusion matrix to be displayed.schema - The Schema of the categories that Instances can be
classified as.public java.lang.String display_confusion_matrix(java.lang.String stream)
stream - Stream to which display is shown.public void display(java.io.BufferedWriter stream)
stream - The writer to which the statistics will be displayed.public java.lang.String toString()
public InstanceList get_training_instance_list()
public InstanceList get_testing_instance_list()
public CatOneTestResult[] get_results()
public ScoringMetrics get_metrics()
public double[][] get_confusion_matrix()
public double total_loss()
public double normalized_loss()
public static void set_compute_log_loss(boolean b)
b - The new setting of the log loss option.public static boolean get_compute_log_loss()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||