def test_subtract_means_masked_and_channel_masked(self): subtract_means(self.X, [9.25], mask=self.M, channel_mask=self.cm) means = get_means(self.X, mask=self.M, channel_mask=self.cm) assert_allclose(means, [0.]) means = get_means(self.X, mask=self.M) assert_allclose(means, [8.25, 0.])
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)
def test_subtract_means_masked(self): subtract_means(self.X, [8.25, 9.25], mask=self.M) means = get_means(self.X, self.M) assert_allclose(means, [0., 0.]) self.assertEqual(self.X[2, 0, 0], 16.) self.assertEqual(self.X[2, 0, 1], 17.)
def test_subtract_means_channel_masked(self): subtract_means(self.X, [12], channel_mask=self.cm) means = get_means(self.X, channel_mask=self.cm) assert_allclose(means, [0.]) means = get_means(self.X) assert_allclose(means, [11., 0.])
def test_get_means_masked_and_channel_masked(self): means = get_means(self.X, mask=self.M, channel_mask=self.cm) assert_allclose(means, [9.25])
def test_subtract_means(self): subtract_means(self.X, [11, 12]) means = get_means(self.X) assert_allclose(means, [0., 0.])
def test_get_means_masked(self): means = get_means(self.X, self.M) assert_allclose(means, [8.25, 9.25])
def test_get_means_channel_masked(self): means = get_means(self.X, channel_mask=self.cm) assert_allclose(means, [12])
def test_get_means(self): means = get_means(self.X) assert_allclose(means, [11., 12.])