コード例 #1
0
    def test_calculation_width_2_depth_100_error(self):
        # Depth out of bounds for width 2
        width = 2
        depth = 100

        pattern = "Legitimate depth of 2<->\\d+ for records with width 2 exceeds limit"
        with self.assertRaisesRegex(RuntimeError, pattern):
            log_sig = esig.stream2logsig(STREAM, depth)
コード例 #2
0
    def test_calculation_width_2_depth_2(self):
        # tosig implementation

        width = 2
        depth = 2

        log_sig = esig.stream2logsig(STREAM, depth)
        self.assert_allclose(log_sig, LOG_SIGNATURE)
コード例 #3
0
    def test_calculation_width_2_depth_1(self):
        # Pure Python implementation
        width = 2
        depth = 1

        log_sig = esig.stream2logsig(STREAM, depth)

        self.assert_allclose(log_sig, LOG_SIGNATURE[:2])
コード例 #4
0
    def test_computed_size_vs_size(self):

        width = 2

        for depth in range(2, 6):
            with self.subTest(depth=depth):
                log_sig = esig.stream2logsig(STREAM, depth)
                size = esig.logsigdim(width, depth)
                self.assertEqual(size, log_sig.size)
コード例 #5
0
    def test_dtype_validation_int64_fails(self):

        width = 2
        depth = 2

        stream = np.array([[1, 2], [3, 4], [5, 6]], dtype=np.int64)

        with self.assertRaises(TypeError):
            log_sig = esig.stream2logsig(stream, depth)
コード例 #6
0
    def test_dtype_validation_float32_passes(self):

        width = 2
        depth = 2

        stream = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]],
                          dtype=np.float32)

        log_sig = esig.stream2logsig(stream, depth)
        self.assertGreater(log_sig.size, 0)
コード例 #7
0
 def transform(x):
     return esig.stream2logsig(x, self.depth).reshape(1, -1)
コード例 #8
0
    def test_calculation_width_2_depth_0_error(self):
        width = 2
        depth = 0

        with self.assertRaises(ValueError):
            log_sig = esig.stream2logsig(STREAM, depth)