Saving an Echo State Network (ReservoirComputing.jl)

Hi,

I am trying to save an Echo State Network (ESN) struct + output Matrix in Julia to load it again in another script to predict a time series. Out of several thousand ESNs, I am choosing the hundred best ones and try to save them. I tried it with JLD, however I cannot load them again. I guess because the struct does not purely consist of arrays. The error I get:

error parsing type string ReservoirComputing.ESN{Core.Int64,Core.Array{Core.Float64,2},ReservoirComputing.Default,ReservoirComputing.NLADefault,Core.Array{Core.Float64,2},ReservoirComputing.RNN{NNlib.#tanh_fast,Core.Float64},Core.Array{Core.Float64,2},Core.Array{Core.Float64,2},ReservoirComputing.StandardStates,Core.Int64,Core.Array{Core.Float64,2}}
Error encountered while load FileIO.File{FileIO.DataFormat{:JLD}, String}("esn_states/esn.jld").

Fatal error:
ERROR: LoadError: syntax: incomplete: premature end of input

How can I save the ESN (or the determining matrices) in the smartest way to be able to construct the ESN again?

You have to load the packages before re-loading the model from JLD

Hi Chris,

I load the same packages that I used in the script to save before. I try it with JLD2 now, saving and loading seems to work:

using JLD2
jldsave("W_Matrix/W_1.jld2"; Wₒᵤₜ)
jldsave("esn_states/esn_1.jld2"; esn)
esn = jldopen("esn_states/esn_1.jld2")
Wₒᵤₜ =jldopen("W_Matrix/W_1.jld2")
prediction = esn(Predictive(val_x), Wₒᵤₜ)

however I get

ERROR: LoadError: MethodError: objects of type JLD2.JLDFile{JLD2.MmapIO} are not callable

when I try to predict with the loaded ESN.

Interesting. Open an issue.

In JLD2.jl or ReservoirComputing.jl?

ReservoirComputing.jl