def confidence(self, features): if not self.votes: self.get_votes(features) choice_votes = self.votes.count(mode(self.votes)) conf = choice_votes / len(self.votes) return conf