AI-ConfusionMatrix
view release on metacpan or search on metacpan
lib/AI/ConfusionMatrix.pm view on Meta::CPAN
$VAR1 = {
'value_expected1' => {
'value_predicted1' => number_of_predictions
},
'value_expected2' => {
'value_predicted1' => number_of_predictions,
'value_predicted2' => number_of_predictions
},
'value_expected3' => {
'value_predicted3' => number_of_predictions
}
};
The output will be in CSV. Here is an example:
,1974,1978,2002,2003,2005,TOTAL,TP,FP,FN,SENS,ACC
1974,3,1,,,2,6,3,4,3,42.86%,50.00%
1978,1,5,,,,6,5,4,1,55.56%,83.33%
2002,2,2,8,,,12,8,1,4,88.89%,66.67%
2003,1,,,7,2,10,7,0,3,100.00%,70.00%
2005,,1,1,,6,8,6,4,2,60.00%,75.00%
TOTAL,7,9,9,7,10,42,29,13,13,69.05%,69.05%
Prettified:
| | 1974 | 1978 | 2002 | 2003 | 2005 | TOTAL | TP | FP | FN | SENS | ACC |
|-------|------|------|------|------|------|-------|----|----|----|---------|--------|
| 1974 | 3 | 1 | | | 2 | 6 | 3 | 4 | 3 | 42.86% | 50.00% |
| 1978 | 1 | 5 | | | | 6 | 5 | 4 | 1 | 55.56% | 83.33% |
| 2002 | 2 | 2 | 8 | | | 12 | 8 | 1 | 4 | 88.89% | 66.67% |
| 2003 | 1 | | | 7 | 2 | 10 | 7 | 0 | 3 | 100.00% | 70.00% |
| 2005 | | 1 | 1 | | 6 | 8 | 6 | 4 | 2 | 60.00% | 75.00% |
| TOTAL | 7 | 9 | 9 | 7 | 10 | 42 | 29 | 13 | 13 | 69.05% | 69.05% |
=over
=item TP:
True Positive
=item FP:
False Positive
=item FN:
False Negative
=item SENS
Sensitivity. Number of true positives divided by the number of positives.
=item ACC:
Accuracy
=back
=head4 C<getConfusionMatrix($hash_ref)>
Get the data used to compute the table above.
Example:
my %cm = getConfusionMatrix(\%matrix);
=head1 AUTHOR
Vincent Lequertier <vi.le@autistici.org>
=head1 LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
1;
# vim: set ts=4 sw=4 tw=0 fdm=marker :
( run in 2.210 seconds using v1.01-cache-2.11-cpan-5b529ec07f3 )