if np.sum(weights) == 0:
weights = np.ones(self.n_classifiers, dtype=int)
votes = np.array([], dtype=int)
for clf_idx, clf in enumerate(self.pool_classifiers):
votes = np.hstack((votes, np.ones(weights[clf_idx], dtype=int) * clf.predict(query)[0]))
return votes
After Change
votes : the number of votes for each class
//
// Select classifier if it correctly classified at least one sample
indices = (competence > 0) // For the rows that are all False (i.e., no base classifier was selected, select all classifiers (set all True)
indices[~np.any(indices, axis=1), :] = True
// weights = self.estimate_competence(query)
// if np.sum(weights) == 0:
// weights = np.ones(self.n_classifiers, dtype=int)