1AI::Categorizer::LearneUrs:e:rDeCcoinstiroinbTurteeedA(I3P:)e:rClatDeogcourmieznetra:t:iLoenarner::DecisionTree(3)
2
3
4
6 AI::Categorizer::Learner::DecisionTree - Decision Tree Learner
7
9 use AI::Categorizer::Learner::DecisionTree;
10
11 # Here $k is an AI::Categorizer::KnowledgeSet object
12
13 my $l = new AI::Categorizer::Learner::DecisionTree(...parameters...);
14 $l->train(knowledge_set => $k);
15 $l->save_state('filename');
16
17 ... time passes ...
18
19 $l = AI::Categorizer::Learner->restore_state('filename');
20 while (my $document = ... ) { # An AI::Categorizer::Document object
21 my $hypothesis = $l->categorize($document);
22 print "Best assigned category: ", $hypothesis->best_category, "\n";
23 }
24
26 This class implements a Decision Tree machine learner, using
27 "AI::DecisionTree" to do the internal work.
28
30 This class inherits from the "AI::Categorizer::Learner" class, so all
31 of its methods are available unless explicitly mentioned here.
32
33 new()
34 Creates a new DecisionTree Learner and returns it.
35
36 train(knowledge_set => $k)
37 Trains the categorizer. This prepares it for later use in categorizing
38 documents. The "knowledge_set" parameter must provide an object of the
39 class "AI::Categorizer::KnowledgeSet" (or a subclass thereof),
40 populated with lots of documents and categories. See
41 AI::Categorizer::KnowledgeSet for the details of how to create such an
42 object.
43
44 categorize($document)
45 Returns an "AI::Categorizer::Hypothesis" object representing the
46 categorizer's "best guess" about which categories the given document
47 should be assigned to. See AI::Categorizer::Hypothesis for more
48 details on how to use this object.
49
50 save_state($path)
51 Saves the categorizer for later use. This method is inherited from
52 "AI::Categorizer::Storable".
53
55 Ken Williams, ken@mathforum.org
56
58 Copyright 2000-2003 Ken Williams. All rights reserved.
59
60 This library is free software; you can redistribute it and/or modify it
61 under the same terms as Perl itself.
62
64 AI::Categorizer(3)
65
66
67
68perl v5.34.0 2022A-I0:1:-C2a0tegorizer::Learner::DecisionTree(3)