SciML / DataDrivenDiffEq.jl

Data driven modeling and automated discovery of dynamical systems for the SciML Scientific Machine Learning organization
https://docs.sciml.ai/DataDrivenDiffEq/stable/
MIT License
404 stars 57 forks source link

Getting Started Example fails #361

Closed schlichtanders closed 2 years ago

schlichtanders commented 2 years ago

Hi there

I just tried to run the getting started example, but experience the following error

using DataDrivenDiffEq
using ModelingToolkit
using LinearAlgebra

f(u) = u.^2 .+ 2.0u .- 1.0
X = randn(1, 100);
Y = reduce(hcat, map(f, eachcol(X)));

problem = DirectDataDrivenProblem(X, Y, name = :Test)

@variables u
basis = Basis(monomial_basis([u], 2), [u])

here it fails wit the following error

MethodError: no method matching Basis(::Vector{Equation}, ::Vector{Sym{Real, Base.ImmutableDict{DataType, Any}}}, ::Vector{Any}, ::Vector{Any}, ::Vector{Any}, ::Num, ::Vector{Any}, ::DataDrivenDiffEq.var"#f#2", ::Symbol, ::Vector{Union{}}; checks=false)
Closest candidates are:
  Basis(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at ~/.julia/packages/DataDrivenDiffEq/XTAjm/src/basis/type.jl:54 got unsupported keyword argument "checks"
  Basis(::Vector{Equation}, ::Vector, ::Vector, ::Vector, ::Vector, ::Num, ::Vector, ::Function, ::Symbol, ::Vector{Basis}) at ~/.julia/packages/DataDrivenDiffEq/XTAjm/src/basis/type.jl:54 got unsupported keyword argument "checks"
  Basis(::AbstractVector{Equation}, ::AbstractVector; parameters, iv, controls, implicits, observed, name, simplify, linear_independent, eval_expression, kwargs...) at ~/.julia/packages/DataDrivenDiffEq/XTAjm/src/basis/type.jl:111
  ...

Stacktrace:
  [1] macro expansion
    @ ~/.julia/packages/ModelingToolkit/fp90z/src/systems/abstractsystem.jl:0 [inlined]
  [2] setproperties(obj::Basis, patch::NamedTuple{(:systems,), Tuple{Vector{Union{}}}})
    @ ModelingToolkit ~/.julia/packages/ModelingToolkit/fp90z/src/systems/abstractsystem.jl:283
  [3] set
    @ ~/.julia/packages/Setfield/AS2xF/src/lens.jl:122 [inlined]
  [4] macro expansion
    @ ~/.julia/packages/Setfield/AS2xF/src/sugar.jl:197 [inlined]
  [5] generate_connection_set!(connectionsets::Vector{ModelingToolkit.ConnectionSet}, sys::Basis, namespace::Nothing)
    @ ModelingToolkit ~/.julia/packages/ModelingToolkit/fp90z/src/systems/connectors.jl:238
  [6] generate_connection_set!
    @ ~/.julia/packages/ModelingToolkit/fp90z/src/systems/connectors.jl:208 [inlined]
  [7] generate_connection_set
    @ ~/.julia/packages/ModelingToolkit/fp90z/src/systems/connectors.jl:203 [inlined]
  [8] n_extra_equations(sys::Basis)
    @ ModelingToolkit ~/.julia/packages/ModelingToolkit/fp90z/src/systems/abstractsystem.jl:742
  [9] show(io::IOContext{IOBuffer}, mime::MIME{Symbol("text/plain")}, sys::Basis)
    @ ModelingToolkit ~/.julia/packages/ModelingToolkit/fp90z/src/systems/abstractsystem.jl:774
 [10] limitstringmime(mime::MIME{Symbol("text/plain")}, x::Basis)
    @ IJulia ~/.julia/packages/IJulia/AQu2H/src/inline.jl:43
 [11] display_mimestring
    @ ~/.julia/packages/IJulia/AQu2H/src/display.jl:71 [inlined]
 [12] display_dict(x::Basis)
    @ IJulia ~/.julia/packages/IJulia/AQu2H/src/display.jl:102
 [13] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [14] invokelatest
    @ ./essentials.jl:714 [inlined]
 [15] execute_request(socket::ZMQ.Socket, msg::IJulia.Msg)
    @ IJulia ~/.julia/packages/IJulia/AQu2H/src/execute_request.jl:112
 [16] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [17] invokelatest
    @ ./essentials.jl:714 [inlined]
 [18] eventloop(socket::ZMQ.Socket)
    @ IJulia ~/.julia/packages/IJulia/AQu2H/src/eventloop.jl:8
 [19] (::IJulia.var"#15#18")()
    @ IJulia ./task.jl:423

Here my status

 [fbb218c0] BSON v0.3.5
  [6e4b80f9] BenchmarkTools v1.3.1
  [e28b5b4c] Bootstrap v2.3.3
  [336ed68f] CSV v0.10.4
  [324d7699] CategoricalArrays v0.10.6
  [134e5e36] Catlab v0.13.10
  [aaaa29a8] Clustering v0.14.2
  [5ae59095] Colors v0.12.8
  [a80b9123] CommonMark v0.8.6
  [a81c6b42] Compose v0.9.3
  [2445eb08] DataDrivenDiffEq v0.8.3
  [a93c6f00] DataFrames v1.3.4
  [864edb3b] DataStructures v0.18.13
  [2b5f629d] DiffEqBase v6.89.5
  [aae7a2af] DiffEqFlux v1.49.0
  [0c46a032] DifferentialEquations v7.1.0
  [b4f34e82] Distances v0.10.7
  [31c24e10] Distributions v0.25.62
  [587475ba] Flux v0.13.3
  [38e38edf] GLM v1.8.0
  [aa1b3936] GraphIO v0.6.0
  [a2cc645c] GraphPlot v0.5.2
  [bd48cda9] GraphRecipes v0.5.9
  [86223c79] Graphs v1.7.0
  [ac1192a8] HypertextLiteral v0.9.4
  [09f84164] HypothesisTests v0.10.10
  [7073ff75] IJulia v1.23.3
  [c601a237] Interact v0.10.4
  [82899510] IteratorInterfaceExtensions v1.0.0
  [5ab0869b] KernelDensity v0.6.3
  [4345ca2d] Loess v0.5.4
  [add582a8] MLJ v0.18.2
  [c6f25543] MLJDecisionTreeInterface v0.2.2
  [1b6a4a23] MLJMultivariateStatsInterface v0.3.1
  [eff96d63] Measurements v2.7.2
  [c03570c3] Memoize v0.4.4
  [626554b9] MetaGraphs v0.7.1
  [e1d29d7a] Missings v1.0.2
  [ff71e718] MixedModels v4.6.4
  [961ee093] ModelingToolkit v8.14.0
  [6f286f6a] MultivariateStats v0.9.1
  [510215fc] Observables v0.4.0
  [a15396b6] OnlineStats v1.5.13
  [925886fa] OnlineStatsBase v1.4.9
  [1dea7af3] OrdinaryDiffEq v6.14.2
  [fae87a5f] ParserCombinator v2.1.1
  [f0f68f2c] PlotlyJS v0.18.8
  [91a5bcdd] Plots v1.29.1
  [c3e4b0f8] Pluto v0.19.8
  [7f904dfe] PlutoUI v0.7.39
  [1a8c2f83] Query v1.0.0
  [ce6b1742] RDatasets v0.7.7
  [0bca4576] SciMLBase v1.39.0
  [1277b4bf] ShiftedArrays v1.0.0
  [860ef19b] StableRNGs v1.0.0
  [90137ffa] StaticArrays v1.4.6
  [2913bbd2] StatsBase v0.33.16
  [4c63d2b9] StatsFuns v1.0.1
  [2cb19f9e] StatsKit v0.3.1
  [3eaba693] StatsModels v0.6.30
  [f3b207a7] StatsPlots v0.14.34
  [bd369af6] Tables v1.7.0
  [ac1d9e8a] ThreadsX v0.1.10
  [9e3dc215] TimeSeries v0.23.0
  [28d57a85] Transducers v0.4.73
  [98b73d46] Trebuchet v0.2.1 `https://github.com/FluxML/Trebuchet.jl.git#master`
  [fce5fe82] Turing v0.21.5
  [0f1e0344] WebIO v0.8.18
  [e88e6eb3] Zygote v0.6.40
  [de0858da] Printf
  [9a3f8284] Random
  [10745b16] Statistics

and here julia version

julia> versioninfo()
Julia Version 1.7.1
Commit ac5cc99908 (2021-12-22 19:35 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, icelake-client)
ChrisRackauckas commented 2 years ago

The one on dev here? https://datadriven.sciml.ai/dev/examples/0_getting_started/

@AlCap23 don't do problem = DirectDataDrivenProblem(X, Y, name = :Test) in the tutorial 😅 , it should be @named problem = DirectDataDrivenProblem(X, Y)

ChrisRackauckas commented 2 years ago

@schlichtanders if you remove Trebuchet and update your packages I assume you're good?

schlichtanders commented 2 years ago

thank you @ChrisRackauckas

yes it was partly due to Trebuchet, partly I needed to do some restarts and ]up

now it works and I still have Trebuchet#master, perfect