multinomialnbpredict

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

Attention: Available only with Twin Activate commercial edition.

Syntax

predictions = multinomialnbpredict(parameters,X)

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

Inputs

parameters
Output of multinomialNBFit 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 multinomialnbpredict

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);
predictions = multinomialnbpredict(parameters, X_test);
> predictions
predictions = [Matrix] 2 x 1
0
0