1AI::Categorizer::LearneUrs:e:rWeCkoan(t3r)ibuted Perl DoAcIu:m:eCnattaetgioornizer::Learner::Weka(3)
2
3
4

NAME

6       AI::Categorizer::Learner::Weka - Pass-through wrapper to Weka system
7

SYNOPSIS

9         use AI::Categorizer::Learner::Weka;
10
11         # Here $k is an AI::Categorizer::KnowledgeSet object
12
13         my $nb = new AI::Categorizer::Learner::Weka(...parameters...);
14         $nb->train(knowledge_set => $k);
15         $nb->save_state('filename');
16
17         ... time passes ...
18
19         $nb = AI::Categorizer::Learner->restore_state('filename');
20         my $c = new AI::Categorizer::Collection::Files( path => ... );
21         while (my $document = $c->next) {
22           my $hypothesis = $nb->categorize($document);
23           print "Best assigned category: ", $hypothesis->best_category, "\n";
24         }
25

DESCRIPTION

27       This class doesn't implement any machine learners of its own, it merely
28       passes the data through to the Weka machine learning system
29       (http://www.cs.waikato.ac.nz/~ml/weka/).  This can give you access to a
30       collection of machine learning algorithms not otherwise implemented in
31       "AI::Categorizer".
32
33       Currently this is a simple command-line wrapper that calls "java"
34       subprocesses.  In the future this may be converted to an "Inline::Java"
35       wrapper for better performance (faster running times).  However, if
36       you're looking for really great performance, you're probably looking in
37       the wrong place - this Weka wrapper is intended more as a way to try
38       lots of different machine learning methods.
39

METHODS

41       This class inherits from the "AI::Categorizer::Learner" class, so all
42       of its methods are available unless explicitly mentioned here.
43
44   new()
45       Creates a new Weka Learner and returns it.  In addition to the
46       parameters accepted by the "AI::Categorizer::Learner" class, the Weka
47       subclass accepts the following parameters:
48
49       java_path
50           Specifies where the "java" executable can be found on this system.
51           The default is simply "java", meaning that it will search your
52           "PATH" to find java.
53
54       java_args
55           Specifies a list of any additional arguments to give to the java
56           process.  Commonly it's necessary to allocate more memory than the
57           default, using an argument like "-Xmx130MB".
58
59       weka_path
60           Specifies the path to the "weka.jar" file containing the Weka
61           bytecode.  If Weka has been installed somewhere in your java
62           "CLASSPATH", you needn't specify a "weka_path".
63
64       weka_classifier
65           Specifies the Weka class to use for a categorizer.  The default is
66           "weka.classifiers.NaiveBayes".  Consult your Weka documentation for
67           a list of other classifiers available.
68
69       weka_args
70           Specifies a list of any additional arguments to pass to the Weka
71           classifier class when building the categorizer.
72
73       tmpdir
74           A directory in which temporary files will be written when training
75           the categorizer and categorizing new documents.  The default is
76           given by "File::Spec->tmpdir".
77
78   train(knowledge_set => $k)
79       Trains the categorizer.  This prepares it for later use in categorizing
80       documents.  The "knowledge_set" parameter must provide an object of the
81       class "AI::Categorizer::KnowledgeSet" (or a subclass thereof),
82       populated with lots of documents and categories.  See
83       AI::Categorizer::KnowledgeSet for the details of how to create such an
84       object.
85
86   categorize($document)
87       Returns an "AI::Categorizer::Hypothesis" object representing the
88       categorizer's "best guess" about which categories the given document
89       should be assigned to.  See AI::Categorizer::Hypothesis for more
90       details on how to use this object.
91
92   save_state($path)
93       Saves the categorizer for later use.  This method is inherited from
94       "AI::Categorizer::Storable".
95

AUTHOR

97       Ken Williams, ken@mathforum.org
98
100       Copyright 2000-2003 Ken Williams.  All rights reserved.
101
102       This library is free software; you can redistribute it and/or modify it
103       under the same terms as Perl itself.
104

SEE ALSO

106       AI::Categorizer(3)
107
108
109
110perl v5.36.0                      2022-07-22 AI::Categorizer::Learner::Weka(3)
Impressum