gaussiannbfit
Gaussian Naïve Bayes classifier.
Syntax
parameters = gaussiannbfit(X,y)
Inputs
- X
- Training data.
- y
- Target values.
Outputs
- parameters
- Contains all the values passed to bernoulliFit method as options. Additionally it has below key-value pairs.
Example
Usage of gaussiannbfit
X = [
-1 -1;
-2 -1;
-3 -2;
1 1;
3 1;
3 2
];
y = [1, 1, 1, 2, 2, 2]';
parameters = gaussiannbfit(X, y)
parameters = struct [
labels: [Matrix] 2 x 1
1
2
params:
{
[1,1] [Matrix] 1 x 2
-2.00000 -1.33333
[1,2] [Matrix] 1 x 2
0.66667 0.22222
[2,1] [Matrix] 1 x 2
2.33333 1.33333
[2,2] [Matrix] 1 x 2
0.88889 0.22222
}
prior:
{
[1,1] 0.5
[2,1] 0.5
}
]
Comments
Output 'parameters' should be passed as input to gaussiannbpredict function.