예제 #1
0
def test_normalize():
    source = np.matrix(test_matrices[0][0])
    target = np.matrix(test_matrices[0][1])

    norm = mc.normalize(source)
    assert np.array_equal(norm, target)
예제 #2
0
def test_normalize_sparse():
    source = csc_matrix(test_matrices[0][0])
    target = np.matrix(test_matrices[0][1])

    norm = mc.normalize(source).todense()
    assert np.array_equal(norm, target)
예제 #3
0
def test_iterate_sparse():
    source = csc_matrix(test_matrices[6][0])
    target = np.matrix(test_matrices[6][1])

    iterated = mc.normalize(mc.iterate(source, 2, 2)).todense()
    assert np.array_equal(np.round(iterated, 4), np.round(target, 4))