NAME

Algorithm::AM::Result - Store results of an AM classification

VERSION

version 3.00

SYNOPSIS

use Algorithm::AM;

my $am = Algorithm::AM->new('finnverb', -commas => 'no');
my ($result) = $am->classify;
print @{ $result->winners };
print $result->statistical_summary;

DESCRIPTION

This package encapsulates all of the classification information generated by "classify" in Algorithm::AM, including the assigned class, score to each class, gang effects, analogical sets, and timing information. It also provides several methods for generating printable reports with this information.

Note that the words 'score' and 'point' are used here to represent whatever count is assigned by analogical modeling during classification. This can be either pointers or occurrences. For an explanation of this, see Algorithm::AM::algorithm.

All of the scores returned by the methods here are scalars with special PV and NV values. You should excercise caution when doing calculations with them. See Algorithm::AM::BigInt for more information.

config_info

Returns a scalar (string) ref containing information about the configuration at the time of classification. Information from the following accessors is included:

exclude_nulls
given_excluded
cardinality
test_in_data
test_item
count_method

statistical_summary

Returns a scalar reference (string) containing a statistical summary of the classification results. The summary includes all possible predicted outcomes with their scores and percentage scores and the total score for all outcomes. Whether the predicted outcome is correct/incorrect/a tie of some sort is also included, if the expected outcome has been provided.

analogical_set

Returns the analogical set in the form of a hash ref mapping exemplar indices to score contributed by the item towards the final classification outcome. Further information about each exemplar can be retrieved from the project object using get_exemplar_(data|spec|outcome) methods.

analogical_set_summary

Returns a scalar reference (string) containing the analogical set, meaning all items that contributed to the predicted outcome, along with the amount contributed by each item (score and percentage overall). Items are ordered by appearance in the data set.

gang_effects

Return a hash describing gang effects. TODO: details, details! Maybe make a gang class to hold these.

gang_summary

Returns a scalar reference (string) containing the gang effects on the final outcome. Gang effects are basically the same as analogical sets, but the total effects of entire subcontexts and supracontexts are also calculated and printed.

A single boolean parameter can be provided to turn on list printing, meaning gang items items are printed. This is false (off) by default.

CONFIGURATION INFORMATION

The following methods provide information about the configuration of AM at the time of classification.

exclude_nulls

Set to the value given by the same method of Algorithm::AM at the time of classification.

given_excluded

Set to the value given by the same method of Algorithm::AM at the time of classification.

cardinality

The number of features used during classification. If there were null feature values and "exclude_nulls" was set to true, then this number will be lower than the cardinality of the utilized data sets.

test_in_data

True if the test item was present among the data items.

test_item

Returns the item which was classified.

count_method

Returns either "linear" or "squared", indicating the setting used for computing analogical sets. See "linear" in Algorithm::AM.

training_set

Returns the data set which was the source of classification data.

CLASSIFICATION INFORMATION

The following methods provide information about the results of the classification.

result

If the class of the test item was known before classification, this returns "tie", "correct", or "incorrect", depending on the outcome of the classification. Otherwise this returns undef.

high_score

Returns the highest score assigned to any of the class labels.

scores

Returns a hash mapping all predicted classes to their scores.

winners

Returns an array ref containing the classes which had the highest score. There is more than one only if there is a tie for the highest score.

is_tie

Returns true if more than one class was assigned the high score.

total_points

The sum total number of points assigned as a score to any contexts.

start_time

Returns the start time of the classification.

end_time

Returns the end time of the classification.

AUTHOR

Theron Stanford <shixilun@yahoo.com>, Nathan Glenn <garfieldnate@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Royal Skousen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.