Beispiel #1
0
 def test_combiner_api_compatibility(self):
     data = np.array([[1], [2], [3], [4], [5]])
     combiner = normalization._NormalizingCombiner(axis=-1)
     expected = {
         "count": np.array(5.0),
         "variance": np.array([2.]),
         "mean": np.array([3.])
     }
     expected_accumulator = combiner._create_accumulator(
         expected["count"], expected["mean"], expected["variance"])
     self.validate_accumulator_serialize_and_deserialize(
         combiner, data, expected_accumulator)
     self.validate_accumulator_uniqueness(combiner, data)
     self.validate_accumulator_extract(combiner, data, expected)
     self.validate_accumulator_extract_and_restore(combiner, data, expected)
Beispiel #2
0
 def test_combiner_computation_multi_value_axis(self, data, axis, expected):
   combiner = normalization._NormalizingCombiner(axis=axis)
   expected_accumulator = combiner._create_accumulator(**expected)
   self.validate_accumulator_computation(combiner, data, expected_accumulator)