You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm discovering this great package. And running the examples given in the notebook of the documentation I face an unexpected error:
the three lines of the notebook (In[17], In[18], In[19]) when running fit(BayesNet, data, (:a=>:b), [StaticCPD{Normal}, LinearGaussianCPD])
or fit(BayesNet, data, (:a=>:b), LinearGaussianCPD)
or
data = DataFrame(c=[1,1,1,1,2,2,2,2,3,3,3,3],
b=[1,1,1,2,2,2,2,1,1,2,1,1],
a=[1,1,1,2,1,1,2,1,1,2,1,1])
fit(DiscreteBayesNet, data, (:a=>:b, :a=>:c, :b=>:c))
give the same error:
MethodError: Cannot convert an object of type Nothing to an object of type Int64
Closest candidates are:
convert(::Type{T}, !Matched::T) where T<:Number at number.jl:6
convert(::Type{T}, !Matched::Number) where T<:Number at number.jl:7
convert(::Type{T}, !Matched::Ptr) where T<:Integer at pointer.jl:23
...
LightGraphs.SimpleGraphs.SimpleEdge{Int64}(::Nothing, ::Nothing) at simpleedge.jl:7
add_edge!(::LightGraphs.SimpleGraphs.SimpleDiGraph{Int64}, ::Nothing, ::Nothing) at SimpleGraphs.jl:90
_get_dag(::DataFrame, ::Tuple{Pair{Symbol,Symbol}}) at learning.jl:34
fit(::Type{BayesNet}, ::DataFrame, ::Pair{Symbol,Symbol}, ::Array{DataType,1}) at learning.jl:59
top-level scope at BayesNets.jl:44
I am with Windows, Atom, Julia 1.4.2.
Is it only happening for me?
Thanks if you can help.
The text was updated successfully, but these errors were encountered:
OK. I think that I found the problem.
When data is a DataFrame, names(data) returns a list of strings, while for the different functions in learning.jl, we need lists of symbols. Therefore: names(data) should become propertynames(data).
It worked for me with this modification.
I'm however surprised that nobody has encountered the problem before.
If somebody is in charge of the package, maybe it could be worth integrating this little modification.
Hi,
I'm discovering this great package. And running the examples given in the notebook of the documentation I face an unexpected error:
the three lines of the notebook (In[17], In[18], In[19]) when running
fit(BayesNet, data, (:a=>:b), [StaticCPD{Normal}, LinearGaussianCPD])
or
fit(BayesNet, data, (:a=>:b), LinearGaussianCPD)
or
give the same error:
MethodError: Cannot
convert
an object of type Nothing to an object of type Int64Closest candidates are:
convert(::Type{T}, !Matched::T) where T<:Number at number.jl:6
convert(::Type{T}, !Matched::Number) where T<:Number at number.jl:7
convert(::Type{T}, !Matched::Ptr) where T<:Integer at pointer.jl:23
...
LightGraphs.SimpleGraphs.SimpleEdge{Int64}(::Nothing, ::Nothing) at simpleedge.jl:7
add_edge!(::LightGraphs.SimpleGraphs.SimpleDiGraph{Int64}, ::Nothing, ::Nothing) at SimpleGraphs.jl:90
_get_dag(::DataFrame, ::Tuple{Pair{Symbol,Symbol}}) at learning.jl:34
fit(::Type{BayesNet}, ::DataFrame, ::Pair{Symbol,Symbol}, ::Array{DataType,1}) at learning.jl:59
top-level scope at BayesNets.jl:44
I am with Windows, Atom, Julia 1.4.2.
Is it only happening for me?
Thanks if you can help.
The text was updated successfully, but these errors were encountered: