Exemple #1
0
    def test_SAX_mechanics_normalize_no_std(self):
        d = __SAX__()
        vals = [10] * STRESS_VALUE_COUNT

        with self.assertRaises(SaxConstrainsException,
                               msg="No standard deviation not caught"):
            d.normalize(vals)
Exemple #2
0
 def test_SAX_mechanics_PAA_identical(self):
     d = __SAX__(points_amount=3)
     vals = reduce(lambda x, y: x + y, [[i, i, i] for i in range(100)])
     expected = list(range(100))
     real, _ = d.to_paa(vals)
     res, msg = assert_almost_equality({1: expected}, {1: list(real)})
     self.assertTrue(res, msg)
Exemple #3
0
 def test_SAX_mechanics_normalize_std(self):
     d = __SAX__()
     vals = [i for i in range(100)]
     mean = 49.5
     std = 28.86607005
     normalized_vals = [(i - mean) / std for i in vals]
     real_vals = d.normalize(vals)
     res, msg = assert_almost_equality({1: normalized_vals}, {1: real_vals})
     self.assertTrue(res, msg)