[BUG]: Cannot predict with MultitargetSRRegressor, ERROR: MethodError: no method matching zero(::@NamedTuple{a::Vector{Float64}, b::Vector{Float64}, c::Vector{Float64}}) The function zero
exists, but no method is defined for this combination of argument types.
#383
Labels
bug
Something isn't working
What happened?
Dear all, we cannot execute this code nor our own for a similar purpose; this code is copy/paste from the API doc.
using MLJ
MultitargetSRRegressor = @load MultitargetSRRegressor pkg=SymbolicRegression
X = (a=rand(100), b=rand(100), c=rand(100))
Y = (y1=(@. cos(X.c) * 2.1 - 0.9), y2=(@. X.a * X.b + X.c))
model = MultitargetSRRegressor(binary_operators=[+, -, *], unary_operators=[exp], niterations=100)
mach = machine(model, X, Y)
fit!(mach)
y_hat = predict(mach, X)
View the equations used:
r = report(mach)
for (output_index, (eq, i)) in enumerate(zip(r.equation_strings, r.best_idx))
println("Equation used for ", output_index, ": ", eq[i])
end
Version
1.11.2
Operating System
Linux
Interface
Julia REPL
Relevant log output
Extra Info
our own code gives:
ERROR: MethodError: no method matching zero(::@NamedTuple{data::@NamedTuple{u1::Vector{…}, u2::Vector{…}, u3::Vector{…}, u4::Vector{…}}, idx::Vector{Int64}})
The function
zero
exists, but no method is defined for this combination of argument types.Closest candidates are:
zero(::Type{Union{}}, Any...)
@ Base number.jl:310
zero(::Type{MutableArithmetics.Zero})
@ MutableArithmetics ~/.julia/packages/MutableArithmetics/BLlgj/src/rewrite.jl:35
zero(::Type{Dates.Date})
@ Dates /usr/share/julia/stdlib/v1.11/Dates/src/types.jl:459
Even if we try something like:
predict(mach,(data=X1x, idx=[4,4,5,3]))
ERROR: MethodError: no method matching zero(::@NamedTuple{data::@NamedTuple{u1::Vector{…}, u2::Vector{…}, u3::Vector{…}, u4::Vector{…}}, idx::Vector{Int64}})
The function
zero
exists, but no method is defined for this combination of argument types.Our environment is:
(@v1.11) pkg> status
Status
~/.julia/environments/v1.11/Project.toml
⌃ [8ce10254] Bumper v0.6.0
[b0b7db55] ComponentArrays v0.15.19
[2445eb08] DataDrivenDiffEq v1.5.0
[5b588203] DataDrivenSparse v0.1.2
[0c46a032] DifferentialEquations v7.15.0
[98e50ef6] JuliaFormatter v1.0.62
[23fbe1c1] Latexify v0.16.5
[d3d80556] LineSearches v7.3.0
[b2108857] Lux v1.4.1
[add582a8] MLJ v0.20.7
[961ee093] ModelingToolkit v9.57.0
[7f7a1694] Optimization v4.0.5
[36348300] OptimizationOptimJL v0.4.1
[42dfb2eb] OptimizationOptimisers v0.3.6
[1dea7af3] OrdinaryDiffEq v6.90.1
[91a5bcdd] Plots v1.40.9
[1ed8b502] SciMLSensitivity v7.71.2
[860ef19b] StableRNGs v1.0.2
[8254be44] SymbolicRegression v1.3.0
[d1185830] SymbolicUtils v3.7.2
[e88e6eb3] Zygote v0.6.73
The text was updated successfully, but these errors were encountered: