Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Classification error for naive Bayes classifier

`L = loss(Mdl,tbl,ResponseVarName)`

`L = loss(Mdl,tbl,Y)`

`L = loss(Mdl,X,Y)`

`L = loss(___,Name,Value)`

returns the minimum classification loss (see Classification Loss), a
scalar representing how well the trained naive Bayes classifier
`L`

= loss(`Mdl`

,`tbl`

,`ResponseVarName`

)`Mdl`

classifies the predictor data in table
`tbl`

) as compared to the true class labels in
`tbl.ResponseVarName`

.

`loss`

normalizes the class probabilities in
`tbl.ResponseVarName`

to the prior class probabilities
`fitcnb`

used for training, stored
in the `Prior`

property of `Mdl`

.

returns the minimum classification loss (`L`

= loss(`Mdl`

,`tbl`

,`Y`

)`L`

), a scalar
representing how well the trained naive Bayes classifier
`Mdl`

classifies the predictor data in table
`tbl`

) as compared to the true class labels in
`Y`

.

`loss`

normalizes the class probabilities in
`Y`

to the prior class probabilities `fitcnb`

used for training, stored
in the `Prior`

property of `Mdl`

.

returns the minimum classification loss (`L`

= loss(`Mdl`

,`X`

,`Y`

)`L`

), a scalar
representing how well the trained naive Bayes classifier
`Mdl`

classifies the predictor data
(`X`

) as compared to the true class labels
(`Y`

).

`loss`

normalizes the class probabilities in
`Y`

to the prior class probabilities `fitcnb`

used for training, stored
in the `Prior`

property of `Mdl`

.

returns the classification loss with additional options specified by one or more
`L`

= loss(___,`Name,Value`

)`Name,Value`

pair arguments, using any of the previous
syntaxes.

[1] Hastie, T., R. Tibshirani, and J. Friedman. *The
Elements of Statistical Learning*, second edition. Springer, New York,
2008.

`ClassificationNaiveBayes`

| `CompactClassificationNaiveBayes`

| `fitcnb`

| `predict`

| `resubLoss`