Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plotclassrep_pjs has difficulties using embeddingobj="hop" #8

Open
lachrimae opened this issue May 30, 2019 · 2 comments
Open

plotclassrep_pjs has difficulties using embeddingobj="hop" #8

lachrimae opened this issue May 30, 2019 · 2 comments

Comments

@lachrimae
Copy link
Contributor

lachrimae commented May 30, 2019

I get errors at the end of the following operation:

Create a Vietoris-Rips complex C from a distance matrix for non-Euclidean data.
Call plotclassrep_pjs(C, dim=1, class=1, showcloud=false, coords="mds", embeddingobj="hop").

I've appended the error message to the end of this comment as error no.1.

I'm currently trying to sort out some of the issues in my fork. I believe part of the problem is some vector-scalar operation issues which I think I've fixed in my master branch. However, there are more issues that arise as in error no.2 appended to the end of this comment. I've made some attempt to fix this in my testhop branch but I don't understand what the desired behaviour is and I don't think I'm doing it properly.

Can you explain what the desired behaviour of these keyword arguments is? Let me know if you'd like me to submit a pull request from my master branch.

I think error no.1 happens inside hopdistance, and error no.2 happens inside edgetrace_pjs.

Error no.1

ERROR: LoadError: MethodError: no method matching setindex_shape_check(::Int64, ::Int64, ::Int64)
Closest candidates are:
  setindex_shape_check(!Matched::AbstractArray{#s72,1} where #s72, ::Integer, ::Integer) at indices.jl:221
  setindex_shape_check(!Matched::AbstractArray{#s72,2} where #s72, ::Integer, ::Integer) at indices.jl:225
  setindex_shape_check(!Matched::AbstractArray, ::Integer...) at indices.jl:179
  ...
Stacktrace:
 [1] macro expansion at ./multidimensional.jl:694 [inlined]
 [2] _unsafe_setindex!(::IndexLinear, ::Array{Int64,2}, ::Int64, ::Base.LogicalIndex{Int64,BitArray{1}}, ::Int64) at ./multidimensional.jl:689
 [3] _setindex! at ./multidimensional.jl:684 [inlined]
 [4] setindex! at ./abstractarray.jl:1020 [inlined]
 [5] hopdistance_sparse(::Array{Int64,1}, ::Array{Int64,1}) at /home/curran/.julia/packages/Eirene/QIFsh/src/Eirene.jl:6320
 [6] #hopdistance#91(::String, ::Function, ::Array{Int64,2}) at /home/curran/.julia/packages/Eirene/QIFsh/src/Eirene.jl:6337
 [7] (::getfield(Eirene, Symbol("#kw##hopdistance")))(::NamedTuple{(:inputis,),Tuple{String}}, ::typeof(Eirene.hopdistance), ::Array{Int64,2}) at ./none:0
 [8] #classrep_pjs#61(::Int64, ::Int64, ::Bool, ::String, ::String, ::Int64, ::String, ::Array{Float64,1}, ::String, ::Array{Any,1}, ::Array{Any,1}, ::String, ::Bool, ::Bool, ::typeof(Eirene.classrep_pjs), ::Dict{String,Any}) at /home/curran/.julia/packages/Eirene/QIFsh/src/Eirene.jl:5367
 [9] #classrep_pjs at ./none:0 [inlined]
 [10] #plotclassrep_pjs#62(::Int64, ::Int64, ::Bool, ::String, ::String, ::Int64, ::String, ::Array{Float64,1}, ::String, ::Array{Any,1}, ::Array{Any,1}, ::String, ::Bool, ::typeof(plotclassrep_pjs), ::Dict{String,Any}) at /home/curran/.julia/packages/Eirene/QIFsh/src/Eirene.jl:5470
 [11] (::getfield(Eirene, Symbol("#kw##plotclassrep_pjs")))(::NamedTuple{(:dim, :class, :coords, :showcloud, :embeddingobj),Tuple{Int64,Int64,String,Bool,String}}, ::typeof(plotclassrep_pjs), ::Dict{String,Any}) at ./none:0
 [12] top-level scope at none:0
in expression starting at /home/curran/scripts/test_julia.jl:5

Error no.2

ERROR: LoadError: BoundsError: attempt to access 3×7 LinearAlgebra.Adjoint{Float64,Array{Float64,2}} at index [1, [10, 225]]
Stacktrace:
 [1] throw_boundserror(::LinearAlgebra.Adjoint{Float64,Array{Float64,2}}, ::Tuple{Int64,Array{Int64,1}}) at ./abstractarray.jl:484
 [2] checkbounds at ./abstractarray.jl:449 [inlined]
 [3] _getindex at ./multidimensional.jl:641 [inlined]
 [4] getindex at ./abstractarray.jl:927 [inlined]
 [5] #edgetrace_pjs#87(::String, ::Function, ::LinearAlgebra.Adjoint{Float64,Array{Float64,2}}, ::Array{Int64,2}) at /home/curran/.julia/packages/Eirene/1rS6N/src/Eirene.jl:5922
 [6] (::getfield(Eirene, Symbol("#kw##edgetrace_pjs")))(::NamedTuple{(:model,),Tuple{String}}, ::typeof(Eirene.edgetrace_pjs), ::LinearAlgebra.Adjoint{Float64,Array{Float64,2}}, ::Array{Int64,2}) at ./none:0
 [7] #classrep_pjs#61(::Int64, ::Int64, ::Bool, ::String, ::String, ::Int64, ::String, ::Array{Float64,1}, ::String, ::Array{Any,1}, ::Array{Any,1}, ::String, ::Bool, ::Bool, ::typeof(Eirene.classrep_pjs), ::Dict{String,Any}) at /home/curran/.julia/packages/Eirene/1rS6N/src/Eirene.jl:5431
 [8] #classrep_pjs at ./none:0 [inlined]
 [9] #plotclassrep_pjs#62(::Int64, ::Int64, ::Bool, ::String, ::String, ::Int64, ::String, ::Array{Float64,1}, ::String, ::Array{Any,1}, ::Array{Any,1}, ::String, ::Bool, ::typeof(plotclassrep_pjs), ::Dict{String,Any}) at /home/curran/.julia/packages/Eirene/1rS6N/src/Eirene.jl:5476
 [10] (::getfield(Eirene, Symbol("#kw##plotclassrep_pjs")))(::NamedTuple{(:dim, :class, :coords, :showcloud, :embeddingobj),Tuple{Int64,Int64,String,Bool,String}}, ::typeof(plotclassrep_pjs), ::Dict{String,Any}) at ./none:0
 [11] top-level scope at none:0
in expression starting at /home/curran/scripts/test_julia.jl:5
@henselman-petrusek
Copy link
Owner

Thanks for the report! Sorry to be brief (busy week, as usual), but just to confirm:

showcloud=false ~ only plot vertices incident to the class representative being graphed (not the full point cloud)

coords="mds" ~ use MDS embedding to get the 3d corrdinates for each vertex

embeddingobj="hop" ~ use the hop distance of the 1-skeleton of the cycle rep to obtain MDS coordinates. more concretely, MDS takes a distance matrix as input and returns coordinates as output. rather than the distance matrix that generated C, this command is saying to (i) take the graph made up of all vertices and edges incident to the cycle representative, (ii) compute the hop distance between vertices of the graph, and (iii) pass that distance matrix to MDS.

hopdistance ~ function to compute hop distance

Pull requests always welcome. Thanks again!

@lachrimae
Copy link
Contributor Author

Thank you. I found the explanation of embeddingobj="hop" in README.md a little bit dense to read, but your description here has resolved my confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants