What is the majority vote algorithm used in Weka. I tried to figure out its code but could not understand it.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In Weka you can select multiple classifiers to be used in
Weka.classifiers.meta.vote. If you selectMajority VotingascombinationRule(which only works withnominalclasses), then each of these classifiers will predict a nominal class label for a test sample. The label which was predicted the most will then be selected as output of thevoteclassifier.For example. You select the following classifiers to be used:
trees.J48,bayes.NaiveBayesandfunctions.LibSVMto predict the weather, which can be labelledbad,normalorgood. Given a new test sample, these are their predictions:The results in the following votes for each possible label:
So Weka’s
voteclassifier will selectgoodas label for the test sample, because it has the most votes amongst all three classifiers.–Edit–
The function
distributionForInstanceMajorityVotingin the source code of Weka’sVoteclass shows you how the majority voting is implemented. I added the function below. Here is a description of what it does:The code works pretty much as I explained above. All nominal classes of the test instance are loaded into
votes. Each classifier classifies the instance and the label with the highest probability gets a vote. If multiple labels have the same probability then all these labels receive a vote. Once all classifiers have cast there vote, the label with the most votes is selected as the label for the test instance. If multiple labels have the same amount of votes, then one of these labels will randomly be selected.