bernoullinbpredict

Predicts target values for the test data points using parameters computed by bernoulliNBFit function.

Attention: Available only with Twin Activate commercial edition.

Syntax

predictions = bernoullinbpredict(parameters,X)

[predictions, probability] = bernoullinbpredict(parameters,X)

Inputs

parameters
Output of dtcFit function.
Type: struct
X
Test data.
Type: double
Dimension: vector | matrix

Outputs

predictions
Predictions for the test data.
Type: double
Dimension: vector | matrix
probability
Probability of the test data being in a class.
Type: double
Dimension: matrix

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