Struct classifier::NaiveBayes [] [src]

pub struct NaiveBayes { /* fields omitted */ }

Naive Bayes classifier

Methods

impl Classifier
[src]

Creates a new classifier

Takes a document that has been tokenized into a vector of strings and a label and adds the document to the list of documents that the classifier is aware of and will train on next time the train() method is called

Takes a document and a label and tokenizes the document by breaking on whitespace characters. The document is added to the list of documents that the classifier is aware of and will train on next time the train() method is called

Adds a list of (document, label) tuples to the classifier

Adds a list of (tokenized document, label) tuples to the classifier

Gets a vector of all of the labels that the classifier has seen so far

Sets the smoothing value (must be greater than 0.0)

Trains the classifier on the documents that have been observed so far

Takes an unlabeled document that has been tokenized into a vector of strings and then computes a classifying label for the document

Takes an unlabeled document and tokenizes it by breaking on spaces and then computes a classifying label for the document

Similar to classify but instead of returning a single label, returns all labels and the probabilities of each one given the document

Similar to classify but instead of returning a single label, returns all labels and the probabilities of each one given the document

Encodes the classifier as a JSON string.

Builds a new classifier from a JSON string

Trait Implementations

impl Debug for Classifier
[src]

Formats the value using the given formatter.

impl Clone for Classifier
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Decodable for Classifier
[src]

Deserialize a value using a Decoder.

impl Encodable for Classifier
[src]

Serialize a value using an Encoder.