Main Content

Classification margins for naive Bayes classifier

returns the Classification Margin (`m`

= margin(`Mdl`

,`tbl`

,`ResponseVarName`

)`m`

) for the trained naive
Bayes classifier `Mdl`

using the predictor data in table
`tbl`

and the class labels in
`tbl.ResponseVarName`

.

returns the classification margins for `m`

= margin(`Mdl`

,`X`

,`Y`

)`Mdl`

using the predictor
data in matrix `X`

and the class labels in
`Y`

.

`m`

is returned as a numeric vector with the same length as
`Y`

. The software estimates each entry of
`m`

using the trained naive Bayes classifier
`Mdl`

, the corresponding row of `X`

, and
the true class label `Y`

.

`ClassificationNaiveBayes`

| `CompactClassificationNaiveBayes`

| `edge`

| `fitcnb`

| `loss`

| `predict`