bernoullinbpredict
Predicts target values for the test data points using parameters computed by bernoulliNBFit function.
Syntax
predictions = bernoullinbpredict(parameters,X)
[predictions, probability] = bernoullinbpredict(parameters,X)
Inputs
- parameters
- Output of dtcFit function.
- X
- Test data.
Outputs
- predictions
- Predictions for the test data.
- probability
- Probability of the test data being in a class.
Example
Usage of bernoullinbpredict
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);
predictions = bernoullinbpredict(parameters, X_test);
> predictions
predictions = 2