I'm searching for a Naive Bayes classifier in R where I can add a paramter for class weights. I need this, because my data is highly unbalanced. Eg.:
- Class1: 1000 examples
- Class2: 800 examples
- Class3: 80 examples
I already tried the Support Vector Machine from the e1071 package which has such a paramter option and this worked quite well:
I already tried the Naive Bayes implementation in the e1071 as well as the caret package, but neither of them seem to have this possibility to define class weights.
Is there another implementation in R with this functionality or does anybody have suggestions how to achive this somehow different?
Thanks an BR
Best Answer
caret
uses the naive Bayes function from theklaR
package. It sounds like you want to adjust the prior:If so, you can pass that to
NaiveBayes
viatrain