def setUpClass(cls): cls.x_equiR_1, cls.w_equiR_1 = qnwequi(n, a, b, "R", random_state=41) temp, cls.w_equiR_3 = qnwequi(n_3, a_3, b_3, "R", random_state=42) # NOTE: I need to do a little magic here. MATLAB and numpy # are generating the same random numbers, but MATLAB is # column major and numpy is row major, so they are stored # in different places for multi-dimensional arrays. # The ravel, reshape code here moves the numpy nodes into # the same relative position as the MATLAB ones. Also, in # order for this to work I have to undo the shifting of # the nodes, re-organize data, then re-shift. If this # seems like voodoo to you, it kinda is. But, the fact # that the test can pass after this kind of manipulation # is a strong indicator that we are doing it correctly unshifted = (temp - a_3) / (b_3 - a_3) reshaped = np.ravel(unshifted).reshape(315, 3, order='F') reshifted = a_3 + reshaped * (b_3 - a_3) cls.x_equiR_3 = reshifted
def setUpClass(cls): cls.x_equiR_1, cls.w_equiR_1 = qnwequi(n, a, b, "R", random_state=41) temp, cls.w_equiR_3 = qnwequi(n_3, a_3, b_3, "R", random_state=42) # NOTE: I need to do a little magic here. MATLAB and numpy # are generating the same random numbers, but MATLAB is # column major and numpy is row major, so they are stored # in different places for multi-dimensional arrays. # The ravel, reshape code here moves the numpy nodes into # the same relative position as the MATLAB ones. Also, in # order for this to work I have to undo the shifting of # the nodes, re-organize data, then re-shift. If this # seems like voodoo to you, it kinda is. But, the fact # that the test can pass after this kind of manipulation # is a strong indicator that we are doing it correctly unshifted = (temp - a_3) / (b_3 - a_3) reshaped = np.ravel(unshifted).reshape(315, 3, order='F') reshifted = a_3 + reshaped * (b_3 - a_3) cls.x_equiR_3 = reshifted
def setUpClass(cls): cls.x_equiH_1, cls.w_equiH_1 = qnwequi(n, a, b, "H") cls.x_equiH_3, cls.w_equiH_3 = qnwequi(n_3, a_3, b_3, "H")
def setUpClass(cls): cls.x_equiH_1, cls.w_equiH_1 = qnwequi(n, a, b, "H") cls.x_equiH_3, cls.w_equiH_3 = qnwequi(n_3, a_3, b_3, "H")