bernoullinbfit
Applies Bernoulli Naïve Bayes model on the input data to compute parameters used for classification. Bernoulli Naïve Bayes is a probabilistic learning method which is used for classification. It assumes that each variable is independent of each other (Naïve assumption) and the input variables have binary values which is an indicator of event.
Attention: Available only with Twin Activate commercial edition.
Syntax
parameters = bernoullinbfit(X,y)
parameters = bernoullinbfit(X,y,options)
Inputs
- X
- Training data.
- y
- Target values.
- options
- Type: struct
Outputs
- parameters
- Contains all the values passed to bernoulliFit method as options. Additionally it has below key-value pairs.
Example
Usage of bernoullinbfit with options
X = [1, 0, 1, 1;
0, 0, 1, 0;
1, 0, 1, 0];
y = [1, 2, 2]';
X_test = X(3, :);
options = struct;
options.binarize_threshold = 0;
options.alpha = 1;
parameters = bernoullinbfit(X, y, options);
> parameters
parameters = struct [
alpha: 1
binarize_threshold: 0
feature_count: [Matrix] 2 x 4
2 1 2 2
2 1 3 1
labels: [Matrix] 2 x 1
1
2
n_features: 4
n_samples: 3
params: [Matrix] 2 x 4
0.66667 0.33333 0.66667 0.66667
0.50000 0.25000 0.75000 0.25000
prior: [Matrix] 2 x 1
-1.09861
-0.40547
]
Comments
Output 'parameters' should be passed as input to bernoullinbpredict function.