niclaspopp / MultivariateDiscretization.jl

MIT License
4 stars 0 forks source link

Error using greedy_IPD(Testdata,dims,35) #8

Open alifarhat40 opened 6 months ago

alifarhat40 commented 6 months ago

Hello,

@niclaspopp I am having trouble running this basic command. I updated all relevant packages, but I am not sure how to debug this. Any help please?

ipd = greedy_IPD(Testdata,dims,35)

WARNING: both StatsBase and Distances export "pairwise"; uses of it in module Clustering must be qualified WARNING: both StatsBase and Distances export "pairwise!"; uses of it in module Clustering must be qualified UndefVarError: pairwise not defined

Stacktrace: [1] _kmeans!(X::Adjoint{Float64, Vector{Float64}}, weights::Nothing, centers::Matrix{Float64}, maxiter::Int64, tol::Float64, displevel::Int64, distance::Distances.SqEuclidean, rng::Random._GLOBAL_RNG) @ Clustering C:\Users\alifa.julia\packages\Clustering\lI5MF\src\kmeans.jl:141 [2] kmeans!(X::Adjoint{Float64, Vector{Float64}}, centers::Matrix{Float64}; weights::Nothing, maxiter::Int64, tol::Float64, display::Symbol, distance::Distances.SqEuclidean, rng::Random._GLOBAL_RNG) @ Clustering C:\Users\alifa.julia\packages\Clustering\lI5MF\src\kmeans.jl:71 [3] kmeans(X::Adjoint{Float64, Vector{Float64}}, k::Int64; weights::Nothing, init::Symbol, maxiter::Int64, tol::Float64, display::Symbol, distance::Distances.SqEuclidean, rng::Random._GLOBAL_RNG) @ Clustering C:\Users\alifa.julia\packages\Clustering\lI5MF\src\kmeans.jl:114 [4] kmeans(X::Adjoint{Float64, Vector{Float64}}, k::Int64) @ Clustering C:\Users\alifa.julia\packages\Clustering\lI5MF\src\kmeans.jl:95 [5] greedy_IPD(M::Matrix{Float64}, ndim::Int64, T::Int64, disc::Symbol, skip::Vector{Any}, limit::Int64) @ MultivariateDiscretization C:\Users\alifa.julia\packages\MultivariateDiscretization\D0sKt\src\IPD.jl:225 [6] greedy_IPD(M::Matrix{Float64}, ndim::Int64, T::Int64) @ MultivariateDiscretization C:\Users\alifa.julia\packages\MultivariateDiscretization\D0sKt\src\IPD.jl:188 [7] top-level scope @ In[4]:1

niclaspopp commented 6 months ago

Hi alifarhat40, thanks for asking the question and pointing out the error! It seems like the error comes from the call of kmeans in line 225 as both StatsBase and Distances export the same function (which has been changed since the release of the package). Thus, it has to be specified which package to use. I'll try to debug that and test it and will push the fix when it's working.

alifarhat40 commented 6 months ago

Thanks.

I don't know why they say it has been resolved here even though it still gives same error:

https://github.com/JuliaStats/Clustering.jl/issues/274#issuecomment-2028457496

alifarhat40 commented 6 months ago

@niclaspopp

I did some changes and managed to get all the functions to run except for the function:

ipd_clustered = greedy_IPD_clustered(Testdata,dims,35,3);

Any idea why it does not run?

image

Also, can you help me interpret your output here for the ipd = greedy_IPD(Testdata,dims,35)

What do the values here represent? are those the bin index for each data point per dimension?