def testFortran(self): """Test if `normalize_logspace` works with a F-contiguous array""" np.random.seed(0) mat = random((NCOL, NROW)).T self.assertTrue(mat.flags["F_CONTIGUOUS"]) mat_out = normalize_logspace(mat) row_sum = mat_out.sum(1) approx_equal = arrays_almost_equal(row_sum, np.ones(NROW), accuracy=ACC) self.assertTrue(approx_equal)
def testMean(self): result = loadmat(join(TEST_DATA_LOC, 'faithful_final_mean.mat'), squeeze_me=True) approx_equal = arrays_almost_equal(self.model.ESS.smm_mean, result['smm_mean'], accuracy=1e-1) self.assertTrue(approx_equal)
def runTest(self): # Test for the correct number of components self.assertEqual(self.model.ESS.num_comp, 3) # Test the means sorted_mean = np.sort(self.model.ESS.smm_mean, 0) approx_equal = arrays_almost_equal(sorted_mean, self.mean, accuracy=1e-1) self.assertTrue(approx_equal)
def runTest(self): test_data = loadmat(join(test_data_loc, mat_filename), squeeze_me=True) args = (test_data[arg] for arg in argument_keys) if load_data: data = loadmat(join(test_data_loc, 'faithful.mat'), squeeze_me=True) args = (data['data'],) + tuple(args) test_result = test_function(*args) approx_equal = arrays_almost_equal(test_data[result_key], test_result, accuracy=max_diff) self.assertTrue(approx_equal)