Guest User

Untitled

a guest
Dec 11th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. !/usr/bin/env perl
  2.  
  3. use Modern::Perl;
  4.  
  5. use Statistics::Contingency;
  6. use Data::Dumper;
  7.  
  8. my $s = Statistics::Contingency->new( categories => [qw/spam ham virus marketing/] );
  9.  
  10. my $t = [
  11. qw/spam spam/ x 1,
  12. qw/spam ham/ x 1,
  13. qw/ham ham/ x 2,
  14. ];
  15.  
  16. while ( @$t ) {
  17. my ( $a, $c ) = (shift @$t, shift @$t);
  18. $s->add_result( $a, $c );
  19. }
  20.  
  21. # will print:
  22. # +---------------------------------------------+
  23. # | maR maP maF1 miR miP miF1 Err |
  24. # | 0.917 0.875 0.867 0.750 0.750 0.750 0.125 |
  25. # +---------------------------------------------+
  26. print $s->stats_table;
Add Comment
Please, Sign In to add comment