Ejemplo n.º 1
0
 def test_majority_vote_empty_item_newmissingvalue(self):
     MV = -99
     # 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 = voting.majority_vote(annotations, MV)
     self.assertEqual(expected, result)
Ejemplo n.º 2
0
 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 = voting.majority_vote(annotations)
     self.assertEqual(expected, result)
def test_majority_vote_empty_item():
    # Test for former 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 = voting.majority_vote(annotations)
    assert result == expected
def test_majority_vote():
    annotations = [
        [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 = [2, 2, 1, 3, 1, 3]
    result = voting.majority_vote(annotations)
    assert result == expected
Ejemplo n.º 5
0
 def test_majority_vote(self):
     annotations = [
         [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 = [2, 2, 1, 3, 1, 3]
     result = voting.majority_vote(annotations)
     self.assertEqual(expected, result)
Ejemplo n.º 6
0
 def test_majority_vote(self):
     annotations = [
         [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 = [2, 2, 1, 3, 1, 3]
     result = voting.majority_vote(annotations)
     self.assertEqual(expected, result)
def test_majority_vote():
    annotations = [
        [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 = [2, 2, 1, 3, 1, 3]
    result = voting.majority_vote(annotations)
    assert result == expected
Ejemplo n.º 8
0
 def test_majority_vote_newmv(self):
     mv = -999
     annotations = [
         [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 = [2, 2, 1, 3, 1, 3]
     result = voting.majority_vote(annotations, missing_value=mv)
     self.assertEqual(expected, result)
Ejemplo n.º 9
0
 def test_majority_vote_newmissingvalue(self):
     m = -99
     annotations = [
         [1, 2, 2, m],
         [2, 2, 2, 2],
         [1, 1, 3, 3],
         [1, 3, 3, 2],
         [m, 2, 3, 1],
         [m, m, m, 3],
     ]
     expected = [2, 2, 1, 3, 1, 3]
     result = voting.majority_vote(annotations, m)
     self.assertEqual(expected, result)
Ejemplo n.º 10
0
 def test_optional_missing_value_majority_vote(self):
     mv = -99
     annotations = [
         [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 = [2, 2, 1, 3, 1, 3]
     result = voting.majority_vote(annotations, mv)
     self.assertEqual(expected, result)
Ejemplo n.º 11
0
 def test_majority_vote_newmissingvalue(self):
     m = -99
     annotations = [
         [1, 2, 2, m],
         [2, 2, 2, 2],
         [1, 1, 3, 3],
         [1, 3, 3, 2],
         [m, 2, 3, 1],
         [m, m, m, 3],
     ]
     expected = [2, 2, 1, 3, 1, 3]
     result = voting.majority_vote(annotations, m)
     self.assertEqual(expected, result)
def test_majority_vote_non_default_missing_value():
    mv = -999
    annotations = [
        [1, 2, 2, mv],
        [2, 2, 2, 2],
        [1, 1, 3, 3],
        [1, 3, 3, 2],
        [mv, 2, 3, 1],
        [mv, mv, mv, 3],
        [mv, mv, mv, mv],
    ]
    expected = [2, 2, 1, 3, 1, 3, mv]
    result = voting.majority_vote(annotations, missing_value=mv)
    assert expected == result