MXNet regression example in Julia fails - julia

Running the code for regression-example.jl fails with the following error:
MethodError: no method matching (::MXNet.mx.var"#5784#5785")(::Float64, ::NDArray{Float32,1})
Closest candidates are:
#5784(::Any) at /Users/**********/.julia/packages/MXNet/XoVCW/src/metric.jl:263
Stacktrace:
[1] (::Base.var"#3#4"{MXNet.mx.var"#5784#5785"})(::Tuple{Float64,NDArray{Float32,1}}) at ./generator.jl:36
[2] iterate at ./generator.jl:47 [inlined]
[3] mapfoldl_impl(::Function, ::Function, ::NamedTuple{(),Tuple{}}, ::Base.Generator{Base.Iterators.Zip{Tuple{Float64,Array{NDArray{Float32,1},1}}},Base.var"#3#4"{MXNet.mx.var"#5784#5785"}}) at ./reduce.jl:55
[4] #mapfoldl#186 at ./reduce.jl:72 [inlined]
[5] mapfoldl at ./reduce.jl:72 [inlined]
[6] #mapreduce#194 at ./reduce.jl:200 [inlined]
[7] mapreduce at ./reduce.jl:200 [inlined]
[8] #reduce#196 at ./reduce.jl:357 [inlined]
[9] reduce(::Function, ::Base.Generator{Base.Iterators.Zip{Tuple{Float64,Array{NDArray{Float32,1},1}}},Base.var"#3#4"{MXNet.mx.var"#5784#5785"}}) at ./reduce.jl:357
[10] #mapreduce#195(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(mapreduce), ::Function, ::Function, ::Float64, ::Vararg{Any,N} where N) at ./reduce.jl:201
[11] mapreduce(::Function, ::Function, ::Float64, ::Array{NDArray{Float32,1},1}) at ./reduce.jl:201
[12] get(::MSE{1}) at /Users/*******/.julia/packages/MXNet/XoVCW/src/metric.jl:263
[13] #fit#5876(::Base.Iterators.Pairs{Symbol,Any,NTuple{5,Symbol},NamedTuple{(:initializer, :eval_metric, :eval_data, :n_epoch, :callbacks),Tuple{NormalInitializer,MSE{1},ArrayDataProvider{Float32,2},Int64,Array{MXNet.mx.BatchCallback,1}}}}, ::typeof(MXNet.mx.fit), ::FeedForward, ::ADAM, ::ArrayDataProvider{Float32,2}) at /Users/********/.julia/packages/MXNet/XoVCW/src/model.jl:545
[14] (::MXNet.mx.var"#kw##fit")(::NamedTuple{(:initializer, :eval_metric, :eval_data, :n_epoch, :callbacks),Tuple{NormalInitializer,MSE{1},ArrayDataProvider{Float32,2},Int64,Array{MXNet.mx.BatchCallback,1}}}, ::typeof(MXNet.mx.fit), ::FeedForward, ::ADAM, ::ArrayDataProvider{Float32,2}) at ./none:0
[15] top-level scope at In[33]:81
Crucial piece of code failing:
mx.fit(model, optimizer, trainprovider,
initializer = mx.NormalInitializer(0.0, 0.1),
eval_metric = mx.MSE(),
eval_data = evalprovider,
n_epoch = 20,
callbacks = [mx.speedometer()])
I suspect the issue is related to mx.MSE() usage but I have no clue how to fix it particularly that there is no good documentation for MXNet.jl

Related

Julia Roots find_zero with ForwardDiff.Dual type?

I'm trying to apply automatic differentiation (ForwardDiff) to a function that contains an instance of find_zero (Roots) and am encountering an error that seems to relate to find_zero not accepting the ForwardDiff.Dual type.
Here's a (contrived) minimal working example that illustrates the issue:
using Distributions
using Roots
using StatsFuns
using ForwardDiff
function test_fun(θ::AbstractVector{T}) where T
μ,σ,p = θ;
z_star = find_zero(z -> logistic(z) - p, 0.0)
return pdf(Normal(μ,σ),z_star)
end
test_fun([0.0,1.0,0.75])
ForwardDiff.gradient(test_fun,[0.0,1.0,0.75])
This results in the following error:
ERROR: MethodError: no method matching Float64(::ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3})
Closest candidates are:
Float64(::Real, ::RoundingMode) where T<:AbstractFloat at rounding.jl:200
Float64(::T) where T<:Number at boot.jl:716
Float64(::Irrational{:invsqrt2}) at irrationals.jl:189
...
Stacktrace:
[1] convert(::Type{Float64}, ::ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}) at ./number.jl:7
[2] setproperty!(::Roots.UnivariateZeroState{Float64,ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}, ::Symbol, ::ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}) at ./Base.jl:34
[3] update_state(::Roots.Secant, ::Roots.DerivativeFree{Roots.DerivativeFree{var"#5#6"{ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}}}, ::Roots.UnivariateZeroState{Float64,ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}, ::Roots.UnivariateZeroOptions{Float64,Float64,ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3},ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}) at /bbkinghome/asharris/.julia/packages/Roots/TZpjF/src/derivative_free.jl:163
[4] find_zero(::Roots.Secant, ::Roots.AlefeldPotraShi, ::Roots.DerivativeFree{Roots.DerivativeFree{var"#5#6"{ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}}}, ::Roots.UnivariateZeroState{Float64,ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}, ::Roots.UnivariateZeroOptions{Float64,Float64,ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3},ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}, ::Roots.NullTracks) at /bbkinghome/asharris/.julia/packages/Roots/TZpjF/src/find_zero.jl:868
[5] find_zero(::Roots.DerivativeFree{var"#5#6"{ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3}}}, ::Float64, ::Roots.Secant, ::Roots.AlefeldPotraShi; tracks::Roots.NullTracks, verbose::Bool, p::Nothing, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /bbkinghome/asharris/.julia/packages/Roots/TZpjF/src/find_zero.jl:689
[6] #find_zero#36 at /bbkinghome/asharris/.julia/packages/Roots/TZpjF/src/derivative_free.jl:123 [inlined]
[7] find_zero at /bbkinghome/asharris/.julia/packages/Roots/TZpjF/src/derivative_free.jl:120 [inlined]
[8] #find_zero#5 at /bbkinghome/asharris/.julia/packages/Roots/TZpjF/src/find_zero.jl:707 [inlined]
[9] find_zero at /bbkinghome/asharris/.julia/packages/Roots/TZpjF/src/find_zero.jl:707 [inlined]
[10] test_fun at ./REPL[7856]:3 [inlined]
[11] vector_mode_dual_eval at /bbkinghome/asharris/.julia/packages/ForwardDiff/QOqCN/src/apiutils.jl:37 [inlined]
[12] vector_mode_gradient(::typeof(test_fun), ::Array{Float64,1}, ::ForwardDiff.GradientConfig{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3,Array{ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3},1}}) at /bbkinghome/asharris/.julia/packages/ForwardDiff/QOqCN/src/gradient.jl:106
[13] gradient(::Function, ::Array{Float64,1}, ::ForwardDiff.GradientConfig{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3,Array{ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3},1}}, ::Val{true}) at /bbkinghome/asharris/.julia/packages/ForwardDiff/QOqCN/src/gradient.jl:19
[14] gradient(::Function, ::Array{Float64,1}, ::ForwardDiff.GradientConfig{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3,Array{ForwardDiff.Dual{ForwardDiff.Tag{typeof(test_fun),Float64},Float64,3},1}}) at /bbkinghome/asharris/.julia/packages/ForwardDiff/QOqCN/src/gradient.jl:17 (repeats 2 times)
[15] top-level scope at REPL[7858]:1
[16] run_repl(::REPL.AbstractREPL, ::Any) at /builddir/build/BUILD/julia/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288
I have limited experience using the FowardDiff package and am probably misunderstanding how the Dual type works, so I would really appreciate if someone knows how to solve this issue. Thanks so much!
z_star = find_zero(z -> logistic(z) - p, 0.0)
You have a fixed initial condition which is non-dual. Make it dual.
z_star = find_zero(z -> logistic(z) - p, zero(eltype(θ))

Interact.jl error: WebIOServer not defined

I am getting this error when using the Interact.jl #manipulate macro in Juno:
UndefVarError: WebIOServer not defined
enter code here
setup_server() at webio.jl:76
show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::MIME{Symbol("application/prs.juno.plotpane+html")}, ::Widget{:manipulate,Any}) at webio.jl:68
show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::String, ::Widget{:manipulate,Any}) at multimedia.jl:109
displayinplotpane(::Widget{:manipulate,Any}) at showdisplay.jl:51
displayandrender(::Widget{:manipulate,Any}) at showdisplay.jl:131
(::Atom.var"#208#213"{String})() at eval.jl:136
#invokelatest#1 at essentials.jl:712 [inlined]
invokelatest at essentials.jl:711 [inlined]
macro expansion at dynamic.jl:24 [inlined]
eval(::String, ::Int64, ::String, ::String, ::Bool) at eval.jl:113
invokelatest(::Any, ::Any, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{,Tuple{}}}) at essentials.jl:712
invokelatest(::Any, ::Any, ::Vararg{Any,N} where N) at essentials.jl:711
macro expansion at eval.jl:41 [inlined]
(::Atom.var"#188#189")() at task.jl:358
Piece of code (the function generatePlot is defined previously for generating Makie plots):
#manipulate for variable = Dict(string(vars[i])=>vars[i] for i=1:16),
labl = Dict(string(label[i])=>label[i] for i=1:length(label))
generatePlot(variable, labl)
end
Env:
[c601a237] Interact v0.10.3
[ee78f7c6] Makie v0.11.0
[85f8d34a] NCDatasets v0.10.2
[2913bbd2] StatsBase v0.33.0
[0f1e0344] WebIO v0.8.14
Any thoughts on what can be the problem?

Why does DifferentialEquations in Julia give me a "no matching method" error for this system of ODEs?

I want to solve a system of seven coupled ODEs in Julia.
My code is:
function bsys!(dv,v,k,t)
dp,thp,dr,thr,dx,thx,phi = v
a = exp(t)
rp = r_y(a)
rr = r_r(a)
rx = r_x(a)
ix = T_a(a)/mx
vy = v_a(a)
tci = (ny_a(a)*vy*(4*pi*alpha*alpha/(3*mx*mx))*sqrt(3/2)*ix)/Hi
H = sqrt((8*pi*G/3)*(rp + rr + rx))/Hi
phidot = -(1 + k*k/(3*H*H*a*a))*phi + 4*pi*G*(rp*dp + rr*dr + rx*dx)/(3*H*H*Hi*Hi)
w = w_a(a)
wd = dw_a(a)
cs2 = cs2_a(a)
wx = wx_a(a)
wdx = dwx_a(a)
cs2x = cs2x_a(a)
dv[1] = -(1+w)*thp/(a*H) - 3*(1+w)*phidot -3*(cs2 - w)*dp + gammatilde*phi/H
dv[2] = -(1-3*w)*thp - k*k*phi/(a*H) - wd*thp/(1 + w) + cs2*k*k*dp/(a*H*(1+w)) + (w/(1+w))*gammatilde*thp/H
dv[3] = -(4/3)*thr/(a*H) - 4*phidot + (rp/rr)*gammatilde*(dp-dr-phi)/H
dv[4] = -k*k*phi/(a*H) + (1/4)*k*k*dr/(a*H) + (rp/rr)*gammatilde*((3/4)*thp - thr)/H
dv[5] = -(1+wx)*thx/(a*H) - 3*(1+wx)*phidot -3*(cs2x - wx)*dx
dv[6] = -(1-3*wx)*thx - k*k*phi/(a*H) - wdx*thx/(1 + wx) + cs2x*k*k*dx/(a*H*(1+wx)) + tci*(thp - thx)/H
dv[7] = phidot
end
tspan = (0.0,3.0)
k = 100*krhtilde
init = (2.0,-0.5*k*k,2.0,-0.5*k*k,2.0,-0.5*k*k,1.0)
prob = ODEProblem(bsys!,init,tspan,k)
sol = solve(prob)
I get the following error:
MethodError: no method matching zero(::NTuple{7,Float64})
Closest candidates are:
zero(!Matched::Type{Missing}) at missing.jl:103
zero(!Matched::Type{LibGit2.GitHash}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.3\LibGit2\src\oid.jl:220
zero(!Matched::Type{Pkg.Resolve.VersionWeights.VersionWeight}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.3\Pkg\src\resolve\VersionWeights.jl:19
...
Stacktrace:
[1] alg_cache(::Tsit5, ::NTuple{7,Float64}, ::NTuple{7,Float64}, ::Type, ::Type, ::Type, ::NTuple{7,Float64}, ::NTuple{7,Float64}, ::ODEFunction{true,typeof(bsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}, ::Float64, ::Float64, ::Float64, ::Float64, ::Bool, ::Val{true}) at C:\Users\hganj\.julia\packages\OrdinaryDiffEq\8Pn99\src\caches\low_order_rk_caches.jl:349
[2] (::OrdinaryDiffEq.var"#197#198"{NTuple{7,Float64},NTuple{7,Float64},DataType,DataType,DataType,NTuple{7,Float64},NTuple{7,Float64},ODEFunction{true,typeof(bsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Float64,Float64,Float64,Bool})(::Tsit5) at C:\Users\hganj\.julia\packages\OrdinaryDiffEq\8Pn99\src\caches\basic_caches.jl:22
[3] map(::OrdinaryDiffEq.var"#197#198"{NTuple{7,Float64},NTuple{7,Float64},DataType,DataType,DataType,NTuple{7,Float64},NTuple{7,Float64},ODEFunction{true,typeof(bsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Float64,Float64,Float64,Bool}, ::Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}}) at .\tuple.jl:140
[4] alg_cache(::CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}}, ::NTuple{7,Float64}, ::NTuple{7,Float64}, ::Type, ::Type, ::Type, ::NTuple{7,Float64}, ::NTuple{7,Float64}, ::ODEFunction{true,typeof(bsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing}, ::Float64, ::Float64, ::Float64, ::Float64, ::Bool, ::Val{true}) at C:\Users\hganj\.julia\packages\OrdinaryDiffEq\8Pn99\src\caches\basic_caches.jl:21
[5] #__init#329(::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Nothing, ::Bool, ::Bool, ::Bool, ::Bool, ::Nothing, ::Bool, ::Bool, ::Float64, ::Float64, ::Float64, ::Bool, ::Bool, ::Rational{Int64}, ::Nothing, ::Nothing, ::Rational{Int64}, ::Int64, ::Int64, ::Int64, ::Rational{Int64}, ::Bool, ::Int64, ::Nothing, ::Nothing, ::Int64, ::typeof(DiffEqBase.ODE_DEFAULT_NORM), ::typeof(LinearAlgebra.opnorm), ::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), ::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Int64, ::String, ::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), ::Nothing, ::Bool, ::Bool, ::Bool, ::Bool, ::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol,Symbol},NamedTuple{(:default_set, :second_time),Tuple{Bool,Bool}}}, ::typeof(DiffEqBase.__init), ::ODEProblem{NTuple{7,Float64},Tuple{Float64,Float64},true,Float64,ODEFunction{true,typeof(bsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}, ::CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}}, ::Array{NTuple{7,Float64},1}, ::Array{Float64,1}, ::Array{Any,1}, ::Type{Val{true}}) at C:\Users\hganj\.julia\packages\OrdinaryDiffEq\8Pn99\src\solve.jl:281
[6] (::DiffEqBase.var"#kw##__init")(::NamedTuple{(:default_set, :second_time),Tuple{Bool,Bool}}, ::typeof(DiffEqBase.__init), ::ODEProblem{NTuple{7,Float64},Tuple{Float64,Float64},true,Float64,ODEFunction{true,typeof(bsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}, ::CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}}, ::Array{NTuple{7,Float64},1}, ::Array{Float64,1}, ::Array{Any,1}, ::Type{Val{true}}) at .\none:0 (repeats 5 times)
[7] #__solve#328(::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol,Symbol},NamedTuple{(:default_set, :second_time),Tuple{Bool,Bool}}}, ::typeof(DiffEqBase.__solve), ::ODEProblem{NTuple{7,Float64},Tuple{Float64,Float64},true,Float64,ODEFunction{true,typeof(bsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}, ::CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}}) at C:\Users\hganj\.julia\packages\OrdinaryDiffEq\8Pn99\src\solve.jl:4
[8] (::DiffEqBase.var"#kw##__solve")(::NamedTuple{(:default_set, :second_time),Tuple{Bool,Bool}}, ::typeof(DiffEqBase.__solve), ::ODEProblem{NTuple{7,Float64},Tuple{Float64,Float64},true,Float64,ODEFunction{true,typeof(bsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}, ::CompositeAlgorithm{Tuple{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType}},AutoSwitch{Tsit5,Rosenbrock23{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}}) at .\none:0
[9] #__solve#1(::Bool, ::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:second_time,),Tuple{Bool}}}, ::typeof(DiffEqBase.__solve), ::ODEProblem{NTuple{7,Float64},Tuple{Float64,Float64},true,Float64,ODEFunction{true,typeof(bsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}, ::Nothing) at C:\Users\hganj\.julia\packages\DifferentialEquations\hc2aQ\src\default_solve.jl:7
[10] #__solve at .\none:0 [inlined]
[11] #__solve#448 at C:\Users\hganj\.julia\packages\DiffEqBase\mDFok\src\solve.jl:185 [inlined]
[12] __solve at C:\Users\hganj\.julia\packages\DiffEqBase\mDFok\src\solve.jl:180 [inlined]
[13] #solve_call#443(::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(DiffEqBase.solve_call), ::ODEProblem{NTuple{7,Float64},Tuple{Float64,Float64},true,Float64,ODEFunction{true,typeof(bsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}) at C:\Users\hganj\.julia\packages\DiffEqBase\mDFok\src\solve.jl:44
[14] solve_call at C:\Users\hganj\.julia\packages\DiffEqBase\mDFok\src\solve.jl:37 [inlined]
[15] #solve#444 at C:\Users\hganj\.julia\packages\DiffEqBase\mDFok\src\solve.jl:67 [inlined]
[16] solve(::ODEProblem{NTuple{7,Float64},Tuple{Float64,Float64},true,Float64,ODEFunction{true,typeof(bsys!),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}) at C:\Users\hganj\.julia\packages\DiffEqBase\mDFok\src\solve.jl:51
[17] top-level scope at In[160]:1
The various function calls within the ODE function bsys are working correctly. I think the issue is with the arithmetic I am doing in the expressions to assign values to dv.
Any help on this would be appreciated. I am new to Julia and have no idea what might be going wrong.
I think init needs to be an array instead of a tuple. Try init = [ ... ] instead of init = ( ... ).

LoadError:PyCall.PyError ("\$(Expr(:escape, :(ccall(#= /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44 =# #pysym(:PyObject_Call)

I am getting the following Error for PyCall and am on Julia v 1.2.0
ERROR: LoadError: PyCall.PyError("\$(Expr(:escape, :(ccall(#= /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44 =# #pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))", PyCall.PyObject(Ptr{PyCall.PyObject_struct} #0x00007f9ea56a2520), PyCall.PyObject(Ptr{PyCall.PyObject_struct} #0x00007f9db65dcca8), PyCall.PyObject(Ptr{PyCall.PyObject_struct} #0x00007f9d004f9f08))
Stacktrace:
[1] pyerr_check at /home/omkar/.julia/packages/PyCall/ttONZ/src/exception.jl:60 [inlined]
[2] pyerr_check at /home/omkar/.julia/packages/PyCall/ttONZ/src/exception.jl:64 [inlined]
[3] macro expansion at /home/omkar/.julia/packages/PyCall/ttONZ/src/exception.jl:84 [inlined]
[4] __pycall!(::PyCall.PyObject, ::Ptr{PyCall.PyObject_struct}, ::PyCall.PyObject, ::Ptr{Nothing}) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44
[5] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{String,String,String,String,String,Float64,String,Float64}, ::Int64, ::Ptr{Nothing}) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:29
[6] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{String,String,String,String,String,Float64,String,Float64}, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:11
[7] #call#111(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::PyCall.PyObject, ::String, ::Vararg{Any,N} where N) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:89
[8] (::PyCall.PyObject)(::String, ::Vararg{Any,N} where N) at /home/omkar/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:89
I have already tried update and below is the setup for the build file
ENV["PYTHON"] = " "
Pkg.build("PyCall")
using PyCall, Conda
pyexec = pyimport("sys").executable

LoadError: type DataFrame has no field x

I have converted a perfectly working map into a pmap
squashed_groups = pmap(group ->
reduce(squash,
DataFrame(eltypes(o), names(o), 0),
eachrow(group)
),
groups)
Apart from the fact that it doesn't seem to engage in any parallelism -- but I will concede that the groups are mostly small -- I get the following error
ERROR: LoadError: type DataFrame has no field x
Stacktrace:
[1] copy!(::Array{DataFrames.AbstractDataFrame,1}, ::Base.Generator{Array{DataFrames.AbstractDataFrame,1},DataFrames.##34#35{Base.##569#571}}) at ./abstractarray.jl:572
[2] _collect(::Type{DataFrames.AbstractDataFrame}, ::Base.Generator{Array{DataFrames.AbstractDataFrame,1},DataFrames.##34#35{Base.##569#571}}, ::Base.HasShape) at ./array.jl:363
[3] map(::Base.##569#571, ::DataFrames.GroupApplied) at /Users/morpheu5/.julia/v0.6/DataFrames/src/groupeddataframe/grouping.jl:184
[4] maptwice(::Function, ::Channel{Any}, ::Array{Any,1}, ::DataFrames.GroupedDataFrame, ::Vararg{DataFrames.GroupedDataFrame,N} where N) at ./asyncmap.jl:188
[5] wrap_n_exec_twice(::Channel{Any}, ::Array{Any,1}, ::Base.Distributed.##204#207{WorkerPool}, ::Function, ::DataFrames.GroupedDataFrame, ::Vararg{DataFrames.GroupedDataFrame,N} where N) at ./asyncmap.jl:154
[6] #async_usemap#553(::Function, ::Void, ::Function, ::##9#10, ::DataFrames.GroupedDataFrame, ::Vararg{DataFrames.GroupedDataFrame,N} where N) at ./asyncmap.jl:103
[7] (::Base.#kw##async_usemap)(::Array{Any,1}, ::Base.#async_usemap, ::Function, ::DataFrames.GroupedDataFrame, ::Vararg{DataFrames.GroupedDataFrame,N} where N) at ./<missing>:0
[8] (::Base.#kw##asyncmap)(::Array{Any,1}, ::Base.#asyncmap, ::Function, ::DataFrames.GroupedDataFrame) at ./<missing>:0
[9] #pmap#203(::Bool, ::Int64, ::Void, ::Array{Any,1}, ::Void, ::Function, ::WorkerPool, ::Function, ::DataFrames.GroupedDataFrame) at ./distributed/pmap.jl:126
[10] pmap(::WorkerPool, ::Function, ::DataFrames.GroupedDataFrame) at ./distributed/pmap.jl:101
[11] #pmap#213(::Array{Any,1}, ::Function, ::Function, ::DataFrames.GroupedDataFrame) at ./distributed/pmap.jl:156
[12] pmap(::Function, ::DataFrames.GroupedDataFrame) at ./distributed/pmap.jl:156
[13] include_from_node1(::String) at ./loading.jl:569
[14] include(::String) at ./sysimg.jl:14
[15] process_options(::Base.JLOptions) at ./client.jl:305
[16] _start() at ./client.jl:371
I couldn't figure out that that means. I even checked for any places where I could have used an x somewhere and changed those, but the error message doesn't change. The inner reduce is a bit complicated, but works using the non-parallel map -- as in, it produces the expected result.
Is this a case of me having read all the docs and having understood none of them, or is this a bug somewhere in Julia? I'm running 0.6.0 on x86_64-apple-darwin13.4.0.

Resources