AI::Ca...er::SVM(3pm)
๐ AI::Categorizer::Learner::SVM โจ
okay bestie, welcome to the AI::Categorizer::Learner::SVM page, straight out of your friendly neighborhood User Contributed Perl Documentation ๐ซถ this is the Support Vector Machine Learner and she is that girl ๐
๐ธ NAME ๐ธ
AI::Categorizer::Learner::SVM โ the Support Vector Machine Learner ๐ฆ
โจ SYNOPSIS โจ
no thoughts, just vibes and a little code, bestie:
use AI::Categorizer::Learner::SVM;
# Here $k is an AI::Categorizer::KnowledgeSet object
my $l = new AI::Categorizer::Learner::SVM(...parameters...);
$l->train(knowledge_set => $k);
$l->save_state('filename');
... time passes ...
$l = AI::Categorizer::Learner->restore_state('filename');
while (my $document = ... ) { # An AI::Categorizer::Document object
my $hypothesis = $l->categorize($document);
print "Best assigned category: ", $hypothesis->best_category, "\n";
}
see how ... time passes ... ? that's the main character arc, honestly ๐ญ save your state, come back later, restore it, keep categorizing. no notes. ๐ฏ
๐ DESCRIPTION ๐
so this class is a Support Vector Machine machine learner โ and yes, that's a mouthful, it's giving "machine learner machine learner", we said what we said ๐ โ and it's built on top of Cory Spencer's Algorithm::SVM module. ๐
and ngl, the tea is: in lots of the recent academic literature, SVMs perform very well for text categorization. lowkey iconic behavior from a math thing. ๐โจ
๐ METHODS ๐
this class inherits from the AI::Categorizer::Learner class, so all of its methods are available too, unless we explicitly mention otherwise right here. periodt. ๐
๐ new()
Creates a new SVM Learner and hands it back to you, wrapped in a little bow ๐
On top of the parameters that the AI::Categorizer::Learner class already accepts, the SVM subclass is also down to accept these:
svm_kernelโ tells it what type of kernel should be used when building the SVM. the default is'linear'. the possible values are'linear','polynomial','radial'and'sigmoid'. pick your fighter, bestie ๐ฅ
๐ train(knowledge_set => $k)
Trains the categorizer. this is the glow-up prep arc โ it gets everything ready so it can categorize documents later. ๐ช
the knowledge_set parameter must provide an object of the class AI::Categorizer::KnowledgeSet (or a subclass of it), and that object needs to be populated with lots and lots of documents and categories. like, feed her, she's hungry ๐
for the deets on how to actually create such an object, go peek at AI::Categorizer::KnowledgeSet.
๐ฆ categorize($document)
Returns an AI::Categorizer::Hypothesis object representing the categorizer's "best guess" about which categories the given document should be assigned to. ๐ฎ
wanna know how to use that object? AI::Categorizer::Hypothesis has all the details. go read it, i'll wait ๐
๐ save_state($path)
Saves the categorizer so you can use it later. this one is inherited from AI::Categorizer::Storable. ๐พ
not me romanticizing a serialization method but the way she preserves your whole trained self for later? that's commitment fr fr ๐ญ๐ซถ
๐ธ AUTHOR ๐ธ
Ken Williams, ken@mathforum.org โจ
๐ COPYRIGHT ๐
Copyright 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 ALSO โญ
go follow them, they're mutuals ๐ซถ
and that's the whole page, bestie!! ๐ this was perl v5.42.0, dated 2025-07-25, and it lives in the User Contributed Perl Documentation section. slay, ate, no crumbs left. ๐ โจ๐
๐ฆ where this page comes from
- fedora 43: perl-AI-Categorizer 0.09-38.fc43 ยท GPL-1.0-or-later OR Artistic-1.0-Perl
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms