Hi, I’m very new to Julia. I want to do some dimension reduction. And I got a

d = Dict{Tuple{String, String}, Vector{Float64}}

first, which is supposed to be my distance matrix. And then in order to do umap, I do

umap(d,2)

while got this error

no method matching UMAP_(::Dict{Tuple{String, String}, Vector{Float64}}, ::Int64)

I tried to use collect(d) to convert the dictionary to other forms still got this error. How to convert the dictionary into the form that should be passed in umap?
Thank you in advance!

From the UMAP documentation, it looks like the umap() function expects its first argument to be a matrix where rows are different features and columns are different samples. So assuming that the dictionary you’re using has its values as the feature vector samples you wish to use, you could do

X = reduce(hcat, values(d))
embedding = umap(X, 2)

In that first line, the values() function creates an iterator of vectors from the dictionary. The reduce() function applies the first argument (hcat) as a function iteratively to subsequent entries of values(d). The function hcat is used to take two or more vectors and concatenate them horizontally (that is such that the vectors become columns of the resulting matrix).

So for instance, the following ways of constructing the matrix are equivalent: