1AI::Categorizer::LearneUrs:e:rSVCMo(n3t)ributed Perl DocAuIm:e:nCtaatteigoonrizer::Learner::SVM(3)
2
3
4
6 AI::Categorizer::Learner::SVM - Support Vector Machine Learner
7
9 use AI::Categorizer::Learner::SVM;
10
11 # Here $k is an AI::Categorizer::KnowledgeSet object
12
13 my $l = new AI::Categorizer::Learner::SVM(...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 Support Vector Machine machine learner, using
27 Cory Spencer's "Algorithm::SVM" module. In lots of the recent academic
28 literature, SVMs perform very well for text categorization.
29
31 This class inherits from the "AI::Categorizer::Learner" class, so all
32 of its methods are available unless explicitly mentioned here.
33
34 new()
35 Creates a new SVM Learner and returns it. In addition to the
36 parameters accepted by the "AI::Categorizer::Learner" class, the SVM
37 subclass accepts the following parameters:
38
39 svm_kernel
40 Specifies what type of kernel should be used when building the SVM.
41 Default is 'linear'. Possible values are 'linear', 'polynomial',
42 'radial' and 'sigmoid'.
43
44 train(knowledge_set => $k)
45 Trains the categorizer. This prepares it for later use in categorizing
46 documents. The "knowledge_set" parameter must provide an object of the
47 class "AI::Categorizer::KnowledgeSet" (or a subclass thereof),
48 populated with lots of documents and categories. See
49 AI::Categorizer::KnowledgeSet for the details of how to create such an
50 object.
51
52 categorize($document)
53 Returns an "AI::Categorizer::Hypothesis" object representing the
54 categorizer's "best guess" about which categories the given document
55 should be assigned to. See AI::Categorizer::Hypothesis for more
56 details on how to use this object.
57
58 save_state($path)
59 Saves the categorizer for later use. This method is inherited from
60 "AI::Categorizer::Storable".
61
63 Ken Williams, ken@mathforum.org
64
66 Copyright 2000-2003 Ken Williams. All rights reserved.
67
68 This library is free software; you can redistribute it and/or modify it
69 under the same terms as Perl itself.
70
72 AI::Categorizer(3), Algorithm::SVM(3)
73
74
75
76perl v5.32.1 2021-01-26 AI::Categorizer::Learner::SVM(3)