AI::Ca...Boolean(3pm)
β¨ NAME β¨
AI::Categorizer::Learner::Boolean β the abstract class for boolean categorizers, bestie π
(yes it's AI::Ca...Boolean(3pm) on the shelf, the terminal just cuts names off like that, it's giving cunty little ellipsis π)
π¦ SYNOPSIS π¦
okay so if you're building your own boolean categorizer, you inherit and you fill in the two blanks, like this:
package AI::Categorizer::Learner::SomethingNew;
use AI::Categorizer::Learner::Boolean;
@ISA = qw(AI::Categorizer::Learner::Boolean);
sub create_boolean_model {
my ($self, $positives, $negatives, $category) = @_;
...
return $something_helpful;
}
sub get_boolean_score {
my ($self, $document, $something_helpful) = @_;
...
return $score;
}
that's it, that's the whole assignment, no cap πΈ
π DESCRIPTION π
so here's the tea, bestie β β this is an abstract class. What does that even mean? It means it's the idea of a class, the blueprint, the vibe, not the finished product.
What it does is iconic: it takes boolean categorizers β and by that we mean categorizers built on algorithms that can only answer yes or no for one single document and one single category β and it glows them up into multi-valued categorizers. β¨
For instance, the decision tree categorizer AI::Categorizer::Learner::DecisionTree keeps a decision tree for each category, and then uses it to decide whether a certain document belongs to the given category. See? Yes/no per category, but multiplied across all the categories. Main character energy π
Any class that inherits from this class should implement the following methods β and the way that it has to implement them, not optional, fr fr:
π§ create_boolean_model() π§
Used during training to create a category-specific model. π
The type of model you create is totally up to you β it should be returned as a scalar. Whatever you return will be available to you in the get_boolean_score() method, so put any information you'll need during categorization in this scalar. That's the whole trick, you just yeet your stuff into one scalar and it comes back to you later π«Ά
In addition to $self, this method will be passed three arguments:
- A reference to an array of positive examples, i.e. documents that belong to the given category β
- A reference to an array of negative examples, i.e. documents that do not belong to the given category β
- The Category object for the given category π·οΈ
π get_boolean_score() π
Used during categorization to assign a score for a single document relative to a single category.
The score should be between 0 and 1, with a score greater than 0.5 indicating membership in the category. So like, 0.9? She's in. 0.2? Not invited to the party π
In addition to $self, this method will be passed two arguments:
- The document to be categorized π
- The value returned by
create_boolean_model()for this category π
π AUTHOR π
Ken Williams, <ken@mathforum.org> β thank you king, we stan π
β SEE ALSO β
AI::Categorizer
and that's the page!! π¦ this doc came from the Perl User Contributed Perl Documentation, and it's stamped perl v5.42.0 dated 2025-07-25 β so yeah, bookmark that date in your brain bestie, it's the version and the timestamp and we do not gatekeep receipts π slay, bye!! π
π¦ 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