I’m new to Julia and looking to use it to analyse time-series.
My current aim is to compare MatrixProfile to RecurrenceMatrix for my application.
The trouble is that with the code below, I am encountering:
ERROR: Computed 0-distances, due to duplicate datapoints in your data. Try to add minimal additive noise to the signal you wish to embed and try again.
My “solution” to that is to use unique()
in pecuzal_embedding
like so:
Y, τ_vals, ts_vals, Ls, εs = pecuzal_embedding(unique(s),w=theiler)
But it doesn’t smell right to me. So what’s the right thing to do ?
using Pkg
Pkg.add("Plots")
Pkg.add("DelayEmbeddings")
Pkg.add("MatrixProfile")
Pkg.add("CSV")
Pkg.add("DataFrames")
Pkg.add("RecurrenceAnalysis")
using Plots
using DelayEmbeddings
using MatrixProfile
using CSV
using DataFrames
using RecurrenceAnalysis
# Input data
csv = CSV.read("test.csv",DataFrame)
s = csv[:,2]
theiler = estimate_delay(s, "mi_min")
Y, τ_vals, ts_vals, Ls, εs = pecuzal_embedding(s,w=theiler)
println("Ls = ", Ls)
println("τ_vals = ", τ_vals)
println("L_total_uni: $(sum(Ls))")
# Calc
R=RecurrenceMatrix(Y,0.5)
recurrenceplot(R; ascii = true)
# RQA Measures
r=rqa(R,theiler=theiler)
for (key, value) in r
println(string(key, " ", value))
end