.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "AI::Categorizer::Experiment 3" .TH AI::Categorizer::Experiment 3 "2008-01-14" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" AI::Categorizer::Experiment \- Coordinate experimental results .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use AI::Categorizer::Experiment; \& my $e = new AI::Categorizer::Experiment(categories => \e%categories); \& my $l = AI::Categorizer::Learner->restore_state(...path...); .Ve .PP .Vb 4 \& while (my $d = ... get document ...) { \& my $h = $l->categorize($d); # A Hypothesis \& $e->add_hypothesis($h, [map $_->name, $d->categories]); \& } .Ve .PP .Vb 2 \& print "Micro F1: ", $e->micro_F1, "\en"; # Access a single statistic \& print $e->stats_table; # Show several stats in table form .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \f(CW\*(C`AI::Categorizer::Experiment\*(C'\fR class helps you organize the results of categorization experiments. As you get lots of categorization results (Hypotheses) back from the Learner, you can feed these results to the Experiment class, along with the correct answers. When all results have been collected, you can get a report on accuracy, precision, recall, F1, and so on, with both macro-averaging and micro-averaging over categories. .SH "METHODS" .IX Header "METHODS" The general execution flow when using this class is to create an Experiment object, add a bunch of Hypotheses to it, and then report on the results. .PP Internally, \f(CW\*(C`AI::Categorizer::Experiment\*(C'\fR inherits from the \&\f(CW\*(C`Statistics::Contingency\*(C'\fR. Please see the documentation of \&\f(CW\*(C`Statistics::Contingency\*(C'\fR for a description of its interface. All of its methods are available here, with the following additions: .IP "new( categories => \e%categories )" 4 .IX Item "new( categories => %categories )" .PD 0 .IP "new( categories => \e@categories, verbose => 1, sig_figs => 2 )" 4 .IX Item "new( categories => @categories, verbose => 1, sig_figs => 2 )" .PD Returns a new Experiment object. A required \f(CW\*(C`categories\*(C'\fR parameter specifies the names of all categories in the data set. The category names may be specified either the keys in a reference to a hash, or as the entries in a reference to an array. .Sp The \f(CW\*(C`new()\*(C'\fR method accepts a \f(CW\*(C`verbose\*(C'\fR parameter which will cause some status/debugging information to be printed to \&\f(CW\*(C`STDOUT\*(C'\fR when \f(CW\*(C`verbose\*(C'\fR is set to a true value. .Sp A \f(CW\*(C`sig_figs\*(C'\fR indicates the number of significant figures that should be used when showing the results in the \f(CW\*(C`results_table()\*(C'\fR method. It does not affect the other methods like \f(CW\*(C`micro_precision()\*(C'\fR. .ie n .IP "add_result($assigned, $correct\fR, \f(CW$name)" 4 .el .IP "add_result($assigned, \f(CW$correct\fR, \f(CW$name\fR)" 4 .IX Item "add_result($assigned, $correct, $name)" Adds a new result to the experiment. Please see the \&\f(CW\*(C`Statistics::Contingency\*(C'\fR documentation for a description of this method. .ie n .IP "add_hypothesis($hypothesis, $correct_categories)" 4 .el .IP "add_hypothesis($hypothesis, \f(CW$correct_categories\fR)" 4 .IX Item "add_hypothesis($hypothesis, $correct_categories)" Adds a new result to the experiment. The first argument is a \&\f(CW\*(C`AI::Categorizer::Hypothesis\*(C'\fR object such as one generated by a Learner's \f(CW\*(C`categorize()\*(C'\fR method. The list of correct categories can be given as an array of category names (strings), as a hash whose keys are the category names and whose values are anything logically true, or as a single string if there is only one category. For example, all of the following are legal: .Sp .Vb 3 \& $e->add_hypothesis($h, "sports"); \& $e->add_hypothesis($h, ["sports", "finance"]); \& $e->add_hypothesis($h, {sports => 1, finance => 1}); .Ve .SH "AUTHOR" .IX Header "AUTHOR" Ken Williams .SH "COPYRIGHT" .IX Header "COPYRIGHT" This distribution is free software; you can redistribute it and/or modify it under the same terms as Perl itself. These terms apply to every file in the distribution \- if you have questions, please contact the author.