Tractables / LogicCircuits.jl

Logic Circuits from the Juice library
https://tractables.github.io/LogicCircuits.jl/dev/
Apache License 2.0
48 stars 4 forks source link

Dataframe issue with converting to Matrix{Bool} #93

Closed khosravipasha closed 3 years ago

khosravipasha commented 3 years ago

It seems in the new version of DataFrames some of the code we have fails intwenty_datasets function.

https://github.com/Juice-jl/LogicCircuits.jl/blob/e92c417386f4b3a9089c1302148d30cbe82c6951/src/LoadSave/data_loaders.jl#L63

The error is

ERROR: MethodError: Cannot `convert` an object of type DataFrames.DataFrame to an object of type Matrix{Bool}
Closest candidates are:
  convert(::Type{Array{T, N}}, ::StaticArrays.SizedArray{S, T, N, N, Array{T, N}}) where {S, T, N} at /home/pasha/.julia/packages/StaticArrays/vxjOO/src/SizedArray.jl:120
  convert(::Type{Array{T, N}}, ::StaticArrays.SizedArray{S, T, N, M, TData} where {M, TData<:AbstractArray{T, M}}) where {T, S, N} at /home/pasha/.julia/packages/StaticArrays/vxjOO/src/SizedArray.jl:114
  convert(::Type{Array{S, N}}, ::PooledArrays.PooledArray{T, R, N, RA} where RA) where {S, T, R, N} at /home/pasha/.julia/packages/PooledArrays/CV8kA/src/PooledArrays.jl:425
  ...
Stacktrace:
 [1] (::LogicCircuits.LoadSave.var"#load#89"{String, String})(type::String)
   @ LogicCircuits.LoadSave ~/.julia/dev/LogicCircuits/src/LoadSave/data_loaders.jl:63
 [2] twenty_datasets(name::String)
   @ LogicCircuits.LoadSave ~/.julia/dev/LogicCircuits/src/LoadSave/data_loaders.jl:65
 [3] top-level scope
   @ REPL[5]:1

Also might want to add a test for twenty_datasets

khosravipasha commented 3 years ago

can use Tables.matrix(dataframe) to do this conversion. Already fixed in the code https://github.com/Juice-jl/LogicCircuits.jl/pull/94