![]() |
![]()
| ![]() |
![]()
NAMEAI::Categorizer::Learner::Weka - Pass-through wrapper to Weka system SYNOPSISuse AI::Categorizer::Learner::Weka; # Here $k is an AI::Categorizer::KnowledgeSet object my $nb = new AI::Categorizer::Learner::Weka(...parameters...); $nb->train(knowledge_set => $k); $nb->save_state('filename'); ... time passes ... $nb = AI::Categorizer::Learner->restore_state('filename'); my $c = new AI::Categorizer::Collection::Files( path => ... ); while (my $document = $c->next) { my $hypothesis = $nb->categorize($document); print "Best assigned category: ", $hypothesis->best_category, "\n"; } DESCRIPTIONThis class doesn't implement any machine learners of its own, it merely passes the data through to the Weka machine learning system (http://www.cs.waikato.ac.nz/~ml/weka/). This can give you access to a collection of machine learning algorithms not otherwise implemented in "AI::Categorizer". Currently this is a simple command-line wrapper that calls "java" subprocesses. In the future this may be converted to an "Inline::Java" wrapper for better performance (faster running times). However, if you're looking for really great performance, you're probably looking in the wrong place - this Weka wrapper is intended more as a way to try lots of different machine learning methods. METHODSThis class inherits from the "AI::Categorizer::Learner" class, so all of its methods are available unless explicitly mentioned here. new()Creates a new Weka Learner and returns it. In addition to the parameters accepted by the "AI::Categorizer::Learner" class, the Weka subclass accepts the following parameters:
train(knowledge_set => $k)Trains the categorizer. This prepares it for later use in categorizing documents. The "knowledge_set" parameter must provide an object of the class "AI::Categorizer::KnowledgeSet" (or a subclass thereof), populated with lots of documents and categories. See AI::Categorizer::KnowledgeSet for the details of how to create such an object. categorize($document)Returns an "AI::Categorizer::Hypothesis" object representing the categorizer's "best guess" about which categories the given document should be assigned to. See AI::Categorizer::Hypothesis for more details on how to use this object. save_state($path)Saves the categorizer for later use. This method is inherited from "AI::Categorizer::Storable". AUTHORKen Williams, ken@mathforum.org COPYRIGHTCopyright 2000-2003 Ken Williams. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSOAI::Categorizer(3)
|