knitr::opts_chunk$set(echo = TRUE)
pip install .
python min_working_example.py
set.seed(42) nile <- as.numeric(Nile) ss_m <- as.numeric(sunspot.month) ss_y <- as.numeric(sunspot.year) test <- c(1, 1, 0, 0, 1, 1, rnorm(100))
Josh's cython implementation:
import ordinal_TSA import numpy as np ts = np.vstack(np.asarray(r.nile)) ordinal_TSA.permutation_entropy(ts, dim = 3, step = 1, w = 1) ts = np.vstack(np.asarray(r.ss_m)) ordinal_TSA.permutation_entropy(ts, dim = 3, step = 1, w = 1) ts = np.vstack(np.asarray(r.ss_y)) ordinal_TSA.permutation_entropy(ts, dim = 3, step = 1, w = 1)
Frank's R implementation:
library(MATSSforecasting) PE(nile, weighted = TRUE, tie_method = "first", word_length = 3, tau = 1) PE(ss_m, weighted = TRUE, tie_method = "first", word_length = 3, tau = 1) PE(ss_y, weighted = TRUE, tie_method = "first", word_length = 3, tau = 1)
Check how ties should be handled for consistency
import ordinal_TSA import numpy as np ts = np.vstack(np.asarray(r.test)) ordinal_TSA.permutation_entropy(ts, dim = 3, step = 1, w = 1)
library(MATSSforecasting) PE(test, weighted = TRUE, tie_method = "first", word_length = 3, tau = 1) PE(test, weighted = TRUE, tie_method = "last", word_length = 3, tau = 1) PE(test, weighted = TRUE, tie_method = "average", word_length = 3, tau = 1) PE(test, weighted = TRUE, tie_method = "random", word_length = 3, tau = 1) PE(test, weighted = TRUE, tie_method = "noise", word_length = 3, tau = 1, noise_amount = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.