Question about LPVSpectral

this is my code

using LPVSpectral, Plots
a=convert(Vector{Float64},rand(20))
λ      = 0.02 # Regularization parameter
λs     = 1    # Regularization parameter group-lasso
normal = true # Use normalized basis functions
Nv     = 50   # Number of basis functions
 x = sort(10rand(20))
  v = range(0, stop=1, length=20) 
se  = ls_spectral_lpv(a,X,V,w_test,Nv; λ = λ, normalize = normal)

this is the errdr:
LoadError: UndefVarError: warn not defined
Stacktrace:
[1] ls_spectral_lpv(::Array{Float64,1}, ::Array{Float64,1}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Int64; λ::Float64, coulomb::Bool, normalize::Bool) at C:\Users\27990.juliapro\JuliaPro_v1.4.2-1\packages\LPVSpectral\7XqRc\src\lsfft.jl:256
[2] top-level scope at untitled-9f246b91b79fbac6d315ccc2dda483e2:57
in expression starting at untitled-9f246b91b79fbac6d315ccc2dda483e2:57
this is the original code

    params      = real_complex_bs(A,Y,λ)
    real_params = [real.(params); imag.(params)]
    AA          = [real.(A) imag.(A)]
    e           = AA*real_params-Y
    Σ           = var(e)*inv(AA'AA + λ*I)
    fva         = 1-var(e)/var(Y)
    fva < 0.9 && warn("Fraction of variance explained = $(fva)")
    SpectralExt(Y, X, V, w, Nv, λ, coulomb, normalize, params, Σ)

Is the “warn” version of the original code no longer supported?thanks!

@baggepinnen

Yeah it looks like the old api for calling warn. You can simply change it to @warn and either open an issue or a PR and I’ll merge it as soon as possible.

ok,thanks!

Made the change here https://github.com/baggepinnen/LPVSpectral.jl/commit/24bf834e0a9b2db81716890a58026e18a0278e46
New version will be out soon. Thanks for the report!

1 Like

Thank you for your answer!!

Hello!I have some other questions to ask you. I have sent you an email. Please help me when you are free.Sorry to trouble you!Thank you!!

No worries, I’ll answer you within a day or so!

thankS!!

Another question is, how do I assign X, Vand other parameters in se = ls_spectral_lpv(a,X,V,w_test,Nv; λ = λ, normalize = normal)?thanks!

What analysis are you trying to perform? If you describe your data, I can map it to the arguments for you, provided that the LPV spectral estimation method is indeed the appropriate method to use.

You also find a description of the arguments in the docstring
https://github.com/baggepinnen/LPVSpectral.jl/blob/24bf834e0a9b2db81716890a58026e18a0278e46/src/lsfft.jl#L226

My data is every 15 minutes.I want LPVSpectral of the weekly data curve.(That is, to analyze the curve composed of 672 points).I don’t understand what these parameters(sample locations、scheduling signal、frequency vector.etc) mean,Forgive me for not being professional :persevere:
Thank you very much!

Are you aware of what analysis the LPV method is performing? If not, it’s probably not the right method to use and you should consider a standard spectral estimate, like ls_spectral. In any case,
Y is the signal you want to analyse, X are the time points at which it is sampled, V is an auxiliary signal that the spectrum of Y depends on. If you don’t have such an auxiliary signal, you should consider standard spectral estimation instead.

Does the auxiliary signal refer to an auxiliary signal?Can I take the signal formed by the average of each moment as an auxiliary signal?

???

I don’t think this method is right for you. Try ls_spectral instead.

1 Like

thanks! i will try it