- “Mdl”: Naïve Bayes classifier model.
- “xdata”: Input data for which you want to calculate the posterior probabilities.
- “PostProbs”: Posterior probabilities of all the classes in your case.
- “labels”: The predicted labels for your input data.
- “MisClassCost”:Misclassification costs for all the classes in each data point.
need to calculates the Posterior probability using fitcnb function classification
조회 수: 2 (최근 30일)
이전 댓글 표시
I need quick help with modifications of the attached code which calculates the prior probability and I need to add a function that calculates the Posterior probability of the data using fitcnb classification function
I tried with to apply similar code of this example but I couldn't fit it into my code
these are the classes inside my dataset
'BENIGN','DrDoS_DNS','DrDoS_LDAP','DrDoS_MSSQL','DrDoS_NetBIOS','DrDoS_NTP','DrDoS_SNMP','DrDoS_SSDP','DrDoS_UDP','Syn','UDP-lag'
where the distribution of BENIGN label should be 50% and the other 50% should be all other labels
Thanks in advance realy appreciate your help
댓글 수: 0
답변 (1개)
Avadhoot
2023년 9월 26일
Hi Ibtihal,
I understand that you have already created a Naïve Bayes Classifier using the “fitcnb” function. To calculate the posterior probabilities, you need to add the following line to your code after the creation of the model.
[labels,PostProbs,MisClassCost] = predict(Mdl,xdata);
The variables in the above line of code contain the following information:
For more information on how the posterior probabilities and misclassification costs are estimated, refer to the following link:
Regards,
Avadhoot.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Naive Bayes에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!