1AI::Categorizer::LearneUrs:e:rBoCoolnetarni(b3u)ted PerlAID:o:cCuamteengtoartiizoenr::Learner::Boolean(3)
2
3
4
6 AI::Categorizer::Learner::Boolean - Abstract class for boolean
7 categorizers
8
10 package AI::Categorizer::Learner::SomethingNew;
11 use AI::Categorizer::Learner::Boolean;
12 @ISA = qw(AI::Categorizer::Learner::Boolean);
13
14 sub create_boolean_model {
15 my ($self, $positives, $negatives, $category) = @_;
16 ...
17 return $something_helpful;
18 }
19
20 sub get_boolean_score {
21 my ($self, $document, $something_helpful) = @_;
22 ...
23 return $score;
24 }
25
27 This is an abstract class which turns boolean categorizers
28 (categorizers based on algorithms that can just provide yes/no
29 categorization decisions for a single document and single category)
30 into multi-valued categorizers. For instance, the decision tree
31 categorizer "AI::Categorizer::Learner::DecisionTree" maintains a
32 decision tree for each category, then uses it to decide whether a
33 certain document belongs to the given category.
34
35 Any class that inherits from this class should implement the following
36 methods:
37
38 create_boolean_model()
39 Used during training to create a category-specific model. The type of
40 model you create is up to you - it should be returned as a scalar.
41 Whatever you return will be available to you in the
42 "get_boolean_score()" method, so put any information you'll need during
43 categorization in this scalar.
44
45 In addition to $self, this method will be passed three arguments. The
46 first argument is a reference to an array of positive examples, i.e.
47 documents that belong to the given category. The next argument is a
48 reference to an array of negative examples, i.e. documents that do not
49 belong to the given category. The final argument is the Category
50 object for the given category.
51
52 get_boolean_score()
53 Used during categorization to assign a score for a single document
54 relative to a single category. The score should be between 0 and 1,
55 with a score greater than 0.5 indicating membership in the category.
56
57 In addition to $self, this method will be passed two arguments. The
58 first argument is the document to be categorized. The second argument
59 is the value returned by "create_boolean_model()" for this category.
60
62 Ken Williams, <ken@mathforum.org>
63
65 AI::Categorizer
66
67
68
69perl v5.36.0 2022-07-2A2I::Categorizer::Learner::Boolean(3)