AI::Ca...Boolean(3pm)

πŸ“¦
version 0.09 Β· 2 versions
, in fedora 43

✨ 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:

  1. A reference to an array of positive examples, i.e. documents that belong to the given category βœ…
  2. A reference to an array of negative examples, i.e. documents that do not belong to the given category ❌
  3. 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:

  1. The document to be categorized πŸ“„
  2. 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