gaussiannbpredict
Predicts target values for the test data points using parameters computed by gaussianNBFit function.
Attention: Available only with Twin Activate commercial edition.
Syntax
predictions = gaussiannbpredict(parameters,X)
[predictions, probability] = gaussiannbpredict(parameters,X)
Inputs
- parameters
- Output of gaussianNBFit function.
- X
- Test data.
Outputs
- predictions
- Predictions for the test data.
- probability
- Probability of the test data being in a class.
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