Ejemplo n.º 1
0
def test_is_multilabel(setup):
    raws = [
        [[1, 2]],
        [0, 1, 0, 1],
        [[1], [0, 2], []],
        np.array([[1, 0], [0, 0]]),
        np.array([[1], [0], [0]]),
        np.array([[1, 0, 0]]),
        np.array([[1., 0.], [0., 0.]]),
        sps.csr_matrix([[1, 0], [0, 1]]),
    ]

    for raw in raws:
        assert is_multilabel(raw).to_numpy() == sklearn_is_multilabel(raw)

    t = mt.tensor(raws[3], chunk_size=1)
    assert is_multilabel(t).to_numpy() == sklearn_is_multilabel(raws[3])
Ejemplo n.º 2
0
    def testIsMultilabel(self):
        raws = [
            [[1, 2]],
            [0, 1, 0, 1],
            [[1], [0, 2], []],
            np.array([[1, 0], [0, 0]]),
            np.array([[1], [0], [0]]),
            np.array([[1, 0, 0]]),
            np.array([[1., 0.], [0., 0.]]),
            sps.csr_matrix([[1, 0], [0, 1]]),
        ]

        for raw in raws:
            self.assertEqual(is_multilabel(raw).execute(),
                             sklearn_is_multilabel(raw),
                             'raw: {}'.format(raw))

        t = mt.tensor(raws[3], chunk_size=1)
        self.assertEqual(is_multilabel(t).execute(),
                         sklearn_is_multilabel(raws[3]))