def test_decode_centroids(self): enc = np.array([[3, 2], [2, 2], [3, 2], [3, 2], [1, 2], [1, 2], [4, 0], [0, 2], [0, 2], [4, 2], [3, 2], [2, 1]]) mapping = [{ 'cons': 0, 'fin': 1, 'nrg': 2, 'tech': 3, 'tel': 4 }, { 'CN': 0, 'NL': 1, 'USA': 2 }] res = decode_centroids(enc, mapping) assert_array_equal(res, STOCKS_CAT)
def test_decode_centroids(self): enc = np.array([[3, 2], [2, 2], [3, 2], [3, 2], [1, 2], [1, 2], [4, 0], [0, 2], [0, 2], [4, 2], [3, 2], [2, 1]]) mapping = [{'cons': 0, 'fin': 1, 'nrg': 2, 'tech': 3, 'tel': 4}, {'CN': 0, 'NL': 1, 'USA': 2}] res = decode_centroids(enc, mapping) assert_array_equal(res, STOCKS_CAT)