def test_majority_vote_empty_item(self): # Bug: majority vote with row of invalid annotations fails annotations = np.array( [[1, 2, 3], [MV, MV, MV], [1, 2, 2]] ) expected = [1, MV, 2] result = pu.majority_vote(annotations) np.testing.assert_equal(expected, result)
def _show_majority_vote_changed(self): plot = self.posterior_plot if self.show_majority_vote: majority = majority_vote(self.annotations) plot.add_markings(majority, 'majority', 'triangle', 0., 0., marker_size=3, line_width=1., marker_color='green') else: plot.remove_markings('majority') plot.plot_posterior.request_redraw()
def test_majority_vote(self): annotations = np.array( [ [1, 2, 2, MV], [2, 2, 2, 2], [1, 1, 3, 3], [1, 3, 3, 2], [MV, 2, 3, 1], [MV, MV, MV, 3] ] ) expected = np.array([2, 2, 1, 3, 1, 3]) result = pu.majority_vote(annotations) np.testing.assert_equal(expected, result)