Naive Bayes Posterior Probability

1 visualizzazione (ultimi 30 giorni)
julian eiler
julian eiler il 24 Ago 2017
Risposto: Don Mathis il 29 Ago 2017
Hi,
I am using a Naive Bayes Classifier which I train with:
Mdl = fitcnb(data,target,...
'Holdout',0.10,...
'OptimizeHyperparameters','auto',...
'HyperparameterOptimizationOptions',...
struct('AcquisitionFunctionName','expected-improvement-plus'));
So when I predit the class of the data results in values of 0 and 1, because I only have two classes. This is pretty nice, but I need to know the certainty of this estimate. So I want to have something like:
class 1: probability 0.4
class 2: probability 0.6
or something like this.
Is the correct function for this the posterior function? As far as I understood it this function is only available for the deprecated NaiveBayes class.
Does anybody know how I can get the probability of the estimate?

Risposta accettata

Don Mathis
Don Mathis il 29 Ago 2017
You can get the posterior probabilities from the second output of the predict method. See this page: http://www.mathworks.com/help/stats/compactclassificationnaivebayes.predict.html
[label,Posterior] = predict(Mdl,X)

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by