Skip to Main Content Skip to Search
Product Documentation

fit - Class: NaiveBayes

Create Naive Bayes classifier object by fitting training data

Syntax

nb = NaiveBayes.fit(training, class)
nb = NaiveBayes.fit(..., 'param1',val1, 'param2',val2, ...)

Description

nb = NaiveBayes.fit(training, class) builds a NaiveBayes classifier object nb. training is an N-by-D numeric matrix of training data. Rows of training correspond to observations; columns correspond to features. class is a classing variable for training (see Grouped Data) taking K distinct levels. Each element of class defines which class the corresponding row of training belongs to. training and class must have the same number of rows.

nb = NaiveBayes.fit(..., 'param1',val1, 'param2',val2, ...) specifies one or more of the following name/value pairs:

How To

  


 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS