def test_asymmetric(self): x = np.matrix(np.ones((10,2))) w = np.matrix(np.arange(10)+1 ).T wp = np.sqrt(w / float(np.sum(w))) correct_x = np.hstack((wp,wp)) print jk._weight(x, w) print correct_x assert np.all(np.abs(jk._weight(x, w) - correct_x) < 1e-6)
def test_asymmetric(self): x = np.matrix(np.ones((10, 2))) w = np.matrix(np.arange(10) + 1).T wp = np.sqrt(w / float(np.sum(w))) correct_x = np.hstack((wp, wp)) print jk._weight(x, w) print correct_x assert np.all(np.abs(jk._weight(x, w) - correct_x) < 1e-6)
def test_symmetric(self): x = np.matrix(np.ones((2,2))) w = np.matrix((0.25,0.75)).T correct_x = np.matrix(( (0.5, 0.5), (0.8660254, 0.8660254)) ) print jk._weight(x, w) assert np.all(np.abs(jk._weight(x, w) - correct_x) < 1e-6)
def test_symmetric(self): x = np.matrix(np.ones((2, 2))) w = np.matrix((0.25, 0.75)).T correct_x = np.matrix(((0.5, 0.5), (0.8660254, 0.8660254))) print jk._weight(x, w) assert np.all(np.abs(jk._weight(x, w) - correct_x) < 1e-6)