Preformance of CKMS+

I keep all my scripts out of the way in a file in this directory.

In [1]:
using DSP, PyPlot, Polynomials, FFTW, Statistics

sc = include("WFbyCKMSplus_scripts.jl")
at = include("../AnalysisToolbox.jl")
mrb = include("../WFMR_bs.jl")
mr  = include("../WFMR.jl")

whf = include("../WhiteningFilters.jl")
util = include("../Utils.jl")
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused

(.:205575): Gdk-CRITICAL **: 09:33:53.530: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed

(.:205575): Gdk-CRITICAL **: 09:33:53.534: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed
Out[1]:
Main.VariousUtilities

As a working test case I pick the AR(2) process $y_n = 5/4y_{n-1} - 3/8y_{n-2} + e_n$ as signal to be estimated and $x_n = y_n + u_n$

In [2]:
sig, pred = sc.KSEdata(10^5; pred_ind = 1:1, sig_ind= 1:1, geni = 1)

[sig; pred]
Sol load location: ../../../data/KSE_Data/ks_pred_lin1e5_r1.jld
Out[2]:
2×100000 Array{Complex{Float64},2}:
 -0.0622791-0.0665026im  -0.0602835-0.0630604im  …  -0.191963+0.0385498im
 -0.0643694-0.0698753im  -0.0622791-0.0665026im     -0.188049+0.0347455im
In [3]:
function testdisp(h,sig,pred; vew = 90:200, f)
    figure(figsize=(12,4))
    title("The filters")
    f == 0 || plot(f,"k.-",label = "exact")
    plot(h[:],"r.:",label = "approx")
    xlabel("lag"); legend()

    sig_hat = at.my_filt(h,pred);

    res = util.TakeLook(sig,sig_hat; vew)
    suptitle("A trajectory and Error over a Window")
    println("MSE: ",var(res[100:end]))
end
Out[3]:
testdisp (generic function with 1 method)

Backslash

In [4]:
# Benchmark
h = @timed mrb.get_wf_bs(sig,pred; M_out = 20)
tim = h.time; h = h.value

vew = 1000:2000
testdisp(h,sig,pred; f=0, vew)

println("Time: ",tim," sec")
MSE: 2.419774794103642e-22
Time: 2.109614455 sec

Old CKMS

In [5]:
# Benchmark
h = @timed mr.get_wf(sig,pred; M_out = 20)
tim = h.time; h = h.value

testdisp(h,sig,pred; f=0 , vew)

println("Time: ",tim," sec")
MSE: 3.204737247181835e-7
Time: 7.753464567 sec

CKMS+ (1 iteration)

In [6]:
# Benchmark
h = @timed sc.vector_wiener_filter_fft(sig,pred, maxit = 1)
tim = h.time; h = h.value

testdisp(h,sig,pred; f = 0, vew)

println("Time: ",tim," sec")
Time taken for crossspect: 4.377708119
Bytes Allocated: 9299540985
Time taken for spectfact: 0.178226404
Bytes Allocated: 83058037
MSE: 8.735118395753873e-8
Time: 4.919858689 sec

CKMS+ (2 iterations)

In [7]:
# Benchmark
h = @timed sc.vector_wiener_filter_fft(sig,pred, maxit = 2)
tim = h.time; h = h.value

testdisp(h,sig,pred; f = 0, vew)

println("Time: ",tim," sec")
Time taken for crossspect: 26.076315655
Bytes Allocated: 54042746048
Time taken for spectfact: 0.004469428
Bytes Allocated: 9330672
MSE: 20.48062928681374
Time: 26.160144 sec

CKMS+ (3 iterations)

In [8]:
# Benchmark
h = @timed sc.vector_wiener_filter_fft(sig,pred, maxit = 3)
tim = h.time; h = h.value

testdisp(h,sig,pred; f = 0, vew)

println("Time: ",tim," sec")
Time taken for crossspect: 86.006293599
Bytes Allocated: 134384535248
Time taken for spectfact: 13.421628925
Bytes Allocated: 21800027568
MSE: 0.011200175848012025
Time: 99.508127817 sec