def test_center_dataset_masked(self): ds = { 'training': (self.X, FramewiseTargets(self.X, self.M)), 'validation': (self.X + 1, FramewiseTargets(self.X, self.M)), 'test': (self.X * 2, FramewiseTargets(self.X, self.M)) } assert_allclose(get_means(ds['training'][0], self.M), [8.25, 9.25]) assert_allclose(get_means(ds['validation'][0], self.M), [9.25, 10.25]) assert_allclose(get_means(ds['test'][0], self.M), [16.5, 18.5]) center_dataset(ds) assert_allclose(get_means(ds['training'][0], self.M), [0., 0.]) assert_allclose(get_means(ds['validation'][0], self.M), [1., 1.]) assert_allclose(get_means(ds['test'][0], self.M), [8.25, 9.25])
def test_center_dataset(self): ds = { 'training': (self.X, FramewiseTargets(self.X)), 'validation': (self.X + 1, FramewiseTargets(self.X)), 'test': (self.X * 2, FramewiseTargets(self.X)) } assert_allclose(get_means(ds['training'][0]), [11., 12.]) assert_allclose(get_means(ds['validation'][0]), [12., 13.]) assert_allclose(get_means(ds['test'][0]), [22., 24.]) center_dataset(ds) assert_allclose(get_means(ds['training'][0]), [0., 0.], atol=1e-6) assert_allclose(get_means(ds['validation'][0]), [1., 1.], atol=1e-6) assert_allclose(get_means(ds['test'][0]), [11., 12.], atol=1e-6)