gaussiannbpredict

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

Attention: Available only with Activate commercial edition.

Syntax

predictions = gaussiannbpredict(parameters,X)

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

Inputs

parameters
Output of gaussianNBFit 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 gaussiannbpredict

X = [
	-1 -1;
	-2 -1;
	-3 -2;
	1 1;
	3 1;
	3 2
];

y = [1, 1, 1, 2, 2, 2]';
parameters = gaussiannbfit(X, y);
[predictions, prob] = gaussiannbpredict(parameters, X);
> prob
prob = [Matrix] 6 x 2
7.60585e-02  1.65396e-09
1.61016e-01  2.21631e-11
3.59275e-02  2.79833e-19
…

> predictions'
ans = [Matrix] 1 x 6
1  1  1  2  2  2