1AI::Categorizer::LearneUrs:e:rGuCeosnsterri(b3u)ted PerlAID:o:cCuamteengtoartiizoenr::Learner::Guesser(3)
2
3
4
6 AI::Categorizer::Learner::Guesser - Simple guessing based on class
7 probabilities
8
10 use AI::Categorizer::Learner::Guesser;
11
12 # Here $k is an AI::Categorizer::KnowledgeSet object
13
14 my $l = new AI::Categorizer::Learner::Guesser;
15 $l->train(knowledge_set => $k);
16 $l->save_state('filename');
17
18 ... time passes ...
19
20 $l = AI::Categorizer::Learner->restore_state('filename');
21 my $c = new AI::Categorizer::Collection::Files( path => ... );
22 while (my $document = $c->next) {
23 my $hypothesis = $l->categorize($document);
24 print "Best assigned category: ", $hypothesis->best_category, "\n";
25 print "All assigned categories: ", join(', ', $hypothesis->categories), "\n";
26 }
27
29 This implements a simple category guesser that makes assignments based
30 solely on the prior probabilities of categories. For instance, if 5%
31 of the training documents belong to a certain category, then the
32 probability of any test document being assigned to that category is
33 0.05. This can be useful for providing baseline scores to compare with
34 other more sophisticated algorithms.
35
36 See AI::Categorizer for a complete description of the interface.
37
39 This class inherits from the "AI::Categorizer::Learner" class, so all
40 of its methods are available.
41
43 Ken Williams ("<ken@mathforum.org>")
44
46 Copyright 2000-2003 Ken Williams. All rights reserved.
47
48 This library is free software; you can redistribute it and/or modify it
49 under the same terms as Perl itself.
50
52 AI::Categorizer(3)
53
54
55
56perl v5.32.0 2020-07-2A8I::Categorizer::Learner::Guesser(3)