Open jd-lara opened 3 years ago
@AlCap23 did you update the project/manifest with the last update?
Ah. Nope. Not right now. I have to fix some issues on the current versioning of DataDriven due to the SymbolicArray introduction and will update within the next few hrs.
Not everything, but the most important parts are working again.
I took the liberty to tag the current status as a release, since the optimization hyperparameters / sparse optimizers changed.
I think I have a related problem. According to the stacktrace, the error is thrown from the following line
nn_problem = ContinuousDataDrivenProblem(X̂, tsample, DX = Ŷ)
saying that collocate_data is given a type signature it has no method for:
MethodError: no method matching collocate_data(::Matrix{Float32}, ::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, ::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, ::InterpolationMethod{UnionAll})
Closest candidates are:
collocate_data(::AbstractVector{T} where T, ::AbstractVector{T} where T, ::AbstractVector{T} where T, ::InterpolationMethod) at /home/henri/.julia/packages/DataDrivenDiffEq/Kd4Hy/src/utils/collocation.jl:216
collocate_data(::Any, ::Any, ::Any) at /home/henri/.julia/packages/DataDrivenDiffEq/Kd4Hy/src/utils/collocation.jl:187
collocate_data(::Any, ::Any, ::InterpolationMethod) at /home/henri/.julia/packages/DataDrivenDiffEq/Kd4Hy/src/utils/collocation.jl:214
You may remember last year I used this example for teaching, this year the same.
Hi! This is strange, I cannot reproduce this. Could you provide a more extensive minimal example?
If I just do
using DataDrivenDiffEq
using LinearAlgebra
X = randn(2,100)
t = 0.0:1.0:99
DX = randn(2,100)
prob = ContinuousDataDrivenProblem(X, t, DX = DX)
I don't get an error, as it should be. Maybe I need to check on the dispatch. Otherwise, you could also use
prob = ContinuousDataDrivenProblem(X, DX, t = t)
Well, unfortunately that will take time. I'll try to get the relevant inputs as data.
By the way I am a bit preoccupied, thanks for the help.
No idea why, but this is what happened:
I reproduced the error in a notebook with nothing but hudson_bay.jl code, except that the two matrices in the call were written to files and read back in.
I then did what you did above, in a new context, reading in the matrix data from the same files. No error.
Might the difference be the code loading?
I get the following mysterious message after the using
statements in hudson_bay.jl:
Activating environment at `~/WorkInProgress/ODEswithJulia2021/Week 3/Project.toml`
┌ Info: DataDrivenDiffEq : OccamNet is available.
└ @ DataDrivenDiffEq /home/henri/.julia/packages/DataDrivenDiffEq/Kd4Hy/src/DataDrivenDiffEq.jl:140
... no such message after using DelimitedFiles, LinearAlgebra, DataDrivenDiffEq
in the minimal, non-erroring context.
I should add that replacing
nn_problem = ContinuousDataDrivenProblem(X̂, tsample, DX = Ŷ)
with
nn_problem = ContinuousDataDrivenProblem(X̂, tsample, Ŷ)
removes the error message.
Here, finally, a MWE:
using LinearAlgebra, DataDrivenDiffEq
tsample = 0.0:0.5:20.0
X = rand(Float32, 2, 41)
Y = rand(Float32, 2, 41)
nn_problem = ContinuousDataDrivenProblem(X, tsample, DX=Y)
gives the error
MethodError: no method matching collocate_data(::Matrix{Float32}, ::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, ::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, ::InterpolationMethod{UnionAll})
Sorry about the toothless mouthing of this problem!
No worries. I just pasted it into the REPL and was able to reproduce the error.
This is due to the type of tsample
being Float64
while the data in X and Y is Float32
. I do need to fix this in the collocation call ( promote type earlier than on the construction of the Problem).
Changing it into
nn_problem = ContinuousDataDrivenProblem(X, Float32.(tsample), DX=Y)
Works for me.
Super. I'll use that workaround in the meantime.
On Wed, 28 Jul 2021 at 07:32, JuliusMartensen @.***> wrote:
No worries. I just pasted it into the REPL and was able to reproduce the error.
This is due to the type of tsample being Float64 while the data in X and Y is Float32. I do need to fix this in the collocation call ( promote type earlier than on the construction of the Problem).
Changing it into
nn_problem = ContinuousDataDrivenProblem(X, Float32.(tsample), DX=Y)
Works for me.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChrisRackauckas/universal_differential_equations/issues/36#issuecomment-888022826, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFCBGB73ZYHVHWSH5FQPJA3TZ6I67ANCNFSM47ESZXIA .
Looks like the LotkaVolterra example folder has an outdated and invalid Manifest file with an old reference to a master of DataDrivenDiffEq
It also seems to have a lot of packages that aren't part of the experiment and there is no Project.toml