Algorithm-Classifier-NaiveBayes
view release on metacpan or search on metacpan
lib/Algorithm/Classifier/NaiveBayes.pm view on Meta::CPAN
$self->{'model'}{'alpha'} = $args{'alpha'};
}
if ( defined( $args{'priors'} ) ) {
$self->{'model'}{'priors'} = $args{'priors'};
}
} ## end sub tweak
=head2 to_string
Returns the model as a JSON string. See the section MODEL FORMAT for
what the JSON looks like.
my $json = $nb->to_string;
The JSON is generated with canonical set, so the keys are sorted,
meaning two calls against the same model will always produce identical
output, making it diffable.
If token_splitter or stop_regex was set to a qr// Regexp, it is
stringified, so the result is always JSON safe.
( run in 0.934 second using v1.01-cache-2.11-cpan-995e09ba956 )