AI::Categorizer::Learner::Guesser - Simple guessing based on class probabilities


AI-Categorizer documentation  | view source Contained in the AI-Categorizer distribution.

Index


NAME

Top

AI::Categorizer::Learner::Guesser - Simple guessing based on class probabilities

SYNOPSIS

Top

  use AI::Categorizer::Learner::Guesser;

  # Here $k is an AI::Categorizer::KnowledgeSet object

  my $l = new AI::Categorizer::Learner::Guesser;
  $l->train(knowledge_set => $k);
  $l->save_state('filename');

  ... time passes ...

  $l = AI::Categorizer::Learner->restore_state('filename');
  my $c = new AI::Categorizer::Collection::Files( path => ... );
  while (my $document = $c->next) {
    my $hypothesis = $l->categorize($document);
    print "Best assigned category: ", $hypothesis->best_category, "\n";
    print "All assigned categories: ", join(', ', $hypothesis->categories), "\n";
  }

DESCRIPTION

Top

This implements a simple category guesser that makes assignments based solely on the prior probabilities of categories. For instance, if 5% of the training documents belong to a certain category, then the probability of any test document being assigned to that category is 0.05. This can be useful for providing baseline scores to compare with other more sophisticated algorithms.

See AI::Categorizer for a complete description of the interface.

METHODS

Top

This class inherits from the AI::Categorizer::Learner class, so all of its methods are available.

AUTHOR

Top

Ken Williams (<ken@mathforum.org>)

COPYRIGHT

Top

SEE ALSO

Top

AI::Categorizer(3)


AI-Categorizer documentation  | view source Contained in the AI-Categorizer distribution.