Implement R package TSdist from python

Viewed 515

I'm trying to implement the R package TSdist from python jupyter notebook.

import rpy2.robjects.numpy2ri
from rpy2.robjects.packages import importr
rpy2.robjects.numpy2ri.activate()

R = rpy2.robjects.r
## load in package 
TSdist = importr('TSdist')
## t,c are two series 
dist = TSdist.ERPDistance(t.values,c.values,g=0,sigma =30)
## dist is a R Boolean vector with one value
dist[0]

This gives me an NA and I got a warning:

/usr/lib64/python3.4/site-packages/rpy2/rinterface/init.py:186: RRuntimeWarning: Error : The series must be univariate vectors

warnings.warn(x, RRuntimeWarning)

Any ideas of how to properly implement it? Or how to measure time series similarity with python packages using discrete Fourier transforms (DFT), Auto-regressive coefficient, Edit distance on real sequence(EDR). Methods mentioned in this paper.

1 Answers
Related