In [1]:
import os
os.getcwd()
Out[1]:
In [2]:
os.chdir("/home/psenin/git/saxpy")
import numpy as np
from saxpy.strfunc import idx2letter
from saxpy.znorm import znorm
from saxpy.paa import paa
from saxpy.alphabet import cuts_for_asize
In [3]:
from saxpy.sax import sax_by_chunking
dat1 = np.array([2.02, 2.33, 2.99, 6.85, 9.2, 8.8, 7.5, 6, 5.85,
3.85, 4.85, 3.85, 2.22, 1.45, 1.34])
dats1_9_7 = "bcggfddba"
dats1_10_11 = "bcjkiheebb"
dats1_14_10 = "bcdijjhgfeecbb"
In [4]:
sax_by_chunking(dat1, 9, 7)
Out[4]:
In [ ]:
dats1_9_7 <- "bcggfddba"
dats1_10_11 <- "bcjkiheebb"
dats1_14_10 <- "bcdijjhgfeecbb"
test_that("points to letters, i.e. SAX, CPP #2", {
str1_10_11 <- paste( matrix(unlist(sax_by_chunking(dat1, 10, 11, 0.01)),
nrow = 10, byrow = T)[,1], collapse = "")
str1_14_10 <- paste( matrix(unlist(sax_by_chunking(dat1, 14, 10, 0.01)),
nrow = 14, byrow = T)[,1], collapse = "")
str1_9_7 <- paste( matrix(unlist(sax_by_chunking(dat1, 9, 7, 0.01)),
nrow = 9, byrow = T)[,1], collapse = "")
expect_equal(str1_10_11, dats1_10_11)
expect_equal(str1_14_10, dats1_14_10)
expect_equal(str1_9_7, dats1_9_7)
})
In [ ]: