I am running a UMAP model as follows:
embedding = umap.UMAP(n_components=2,n_neighbors=30, min_dist=0.0, metric='euclidean').fit(data)
And plotting:
f = umap.plot.points(embedding, labels=df['name'])
This generates a nice looking graph. I'd like to get the coordinates of the points plotted, to move to a different visualisation. I don't fully understand what is stored in the embedding object.
Is there a way I can export to something like:
[{'name': name1, 'x-value': x1, 'y-value': y1}, {'name': name2, 'x-value': x2, 'y-value': y2 }...]
Or similar?
One option would be to create a DataFrame with coordinates, add a column with the names, and turn it into a list of dicts.
It seems like you already have a DataFrame with the column
name
. If that's the case, I'd go for something like: