multinomialnbfit
Multinomial Naïve Bayes classifier.
Attention: Available only with Twin Activate commercial edition.
Syntax
parameters = multinomialnbfit(X,y)
parameters = multinomialnbfit(X,y,options)
Inputs
- X
- Training data.
- y
- Target values.
- options
- Type: struct
Outputs
- parameters
- Contains all the values passed to multinomialFit method as options. Additionally it has below key-value pairs.
Example
Usage of multinomialnbfit
X = [2, 1, 0, 0, 0, 0;
2, 0, 1, 0, 0, 0;
1, 0, 0, 1, 0, 0;
1, 0, 0, 0, 1, 1
];
y = [1, 1, 1, 0]';
X_test = [3, 0, 0, 0, 1, 1;
0, 1, 1, 0, 1, 1
];
options = struct;
options.alpha = 0;
parameters = multinomialnbfit(X, y, options)
parameters = struct [
alpha: 0
feature_count: [Matrix] 2 x 6
1 0 0 0 1 1
5 1 1 1 0 0
labels: [Matrix] 2 x 1
0
1
n_features: 6
n_samples: 4
...
Comments
User need not assume that the probability values estimated are between 0 and 1. Some transformations are made to accommodate multiplication of smaller fraction values which won’t lead to underflow errors. Output 'parameters' should be passed as input to multinomialnbpredict function.