From 405e7da01460e0dfdcab6342a8ec5642e09231cc Mon Sep 17 00:00:00 2001 From: seninp Date: Mon, 19 Oct 2015 21:07:47 +0200 Subject: [PATCH] so, lets release? --- inst/plotting.R | 63 ------------------------------------------- inst/sliding_tinker.R | 23 ---------------- 2 files changed, 86 deletions(-) delete mode 100644 inst/plotting.R delete mode 100644 inst/sliding_tinker.R diff --git a/inst/plotting.R b/inst/plotting.R deleted file mode 100644 index a3eaa76..0000000 --- a/inst/plotting.R +++ /dev/null @@ -1,63 +0,0 @@ -y = c(-1, -2, -1, 0, 2, 1, 1, 0) -plot(y, type = "l", col = "blue", xlim = c(0,8), - main="8-points time series and its PAA transform into 3 points") - -points(y, pch=16, lwd=5, col="blue") - -abline(v=c(1,1+7/3,1+7/3*2,8), lty=3, lwd=2, col="gray50") - -y_paa3 = paa(y, 3) - -segments(1,y_paa3[1],1+7/3,y_paa3[1],lwd=1,col="red") -points(x=1+7/3/2,y=y_paa3[1],col="red",pch=23,lwd=5) - -segments(1+7/3,y_paa3[2],1+7/3*2,y_paa3[2],lwd=1,col="red") -points(x=1+7/3+7/3/2,y=y_paa3[2],col="red",pch=23,lwd=5) - -segments(1+7/3*2,y_paa3[3],8,y_paa3[3],lwd=1,col="red") -points(x=1+7/3*2+7/3/2,y=y_paa3[3],col="red",pch=23,lwd=5) - -# -# ############# -# -y = c(-1, -2, -1, 0, 2, 1, 1, 0) -plot(y, type="l", col="blue", xlim=c(0,8), - main="8-points time series and its SAX transform into 3 letters string \'acc\'") -points(y, pch=16, lwd=5, col="blue") -abline(v=c(1,1+7/3,1+7/3*2,8), lty=3, lwd=2, col="gray50") -y_paa3 = paa(y, 3) -segments(1,y_paa3[1],1+7/3,y_paa3[1],lwd=1,col="red") -points(x=1+7/3/2,y=y_paa3[1],col="red",pch=23,lwd=5) -segments(1+7/3,y_paa3[2],1+7/3*2,y_paa3[2],lwd=1,col="red") -points(x=1+7/3+7/3/2,y=y_paa3[2],col="red",pch=23,lwd=5) -segments(1+7/3*2,y_paa3[3],8,y_paa3[3],lwd=1,col="red") -points(x=1+7/3*2+7/3/2,y=y_paa3[3],col="red",pch=23,lwd=5) - -y <- seq(-2,2, length=100) -x <- dnorm(y, mean=0, sd=1) -lines(x,y, type="l", lwd=5, col="magenta") -abline(h = alphabet2cuts(3)[2:3], lty=2, lwd=2, col="magenta") -text(0.7,-1,"a",cex=2,col="magenta") -text(0.7, 0,"b",cex=2,col="magenta") -text(0.7, 1,"c",cex=2,col="magenta") - -ts2string(y_paa3, 3) - -min_dist(ts2string(y_paa3, 3), ts2string(rev(y_paa3), 3), 3) -str1=ts2string(y_paa3, 3) -str2=ts2string(rev(y_paa3), 3) - -letters2idx(c('a','b','c','a')) - -library(testthat) -library(covr) -package_coverage() - -X = c(-1, -2, -1, 0, 2, 1, 1, 0) -p1=mean(X[1:4]) -p2=sum(X[5:8])/4 - -p1 -p2 -sd(znorm(X)) -mean(znorm(X)) diff --git a/inst/sliding_tinker.R b/inst/sliding_tinker.R deleted file mode 100644 index e70e0fd..0000000 --- a/inst/sliding_tinker.R +++ /dev/null @@ -1,23 +0,0 @@ -x = seq(0, pi*4, 0.02) -ts = sin(x) * 5 + rnorm(length(x)) -paa_size = 5 -alphabet_size = 3 -window_size = 10 -n_threshold = 0.01 - -library(plyr) -#ts2sax_via_window <- function(ts, paa_size, alphabet_size, window_size, n_threshold){ - - res = matrix(c(NA, NA), nrow=1) - for (i in c(1:(length(ts) - window_size - 1))) { - tmp = ts[i:(i + window_size)] - tmp_znorm = znorm(tmp, n_threshold) - tmp_paa = paa(tmp_znorm, paa_size) - tmp_sax = paste(ts2string(tmp_paa, alphabet_size), sep = "", collapse = "") - res = c(res, c(i, tmp_sax)) - } - - -#} - -i=100