Replies: 3 comments 3 replies
-
The current approach builds a graph where vertices are training samples, and that can be extracted as the The important point here is the contrast between train and transformed samples: train samples can have edges joining them, but transform samples only have edges to training samples. If you want to get an adjacency matrix for the combined train and test data then you can effectively do: train_graph = mapper.graph_
test_graph = mapper.transform(test_data)
full_adjacency = scipy.sparse.vstack(
[
scipy.sparse.hstack([train_graph, test_graph.transpose()]),
scipy.sparse.hstack([test_graph, scipy.sparse.csr_matrix((test_graph.shape[0], test_graph.shape[0]))
]
) All we are doing here is putting together all the blocks. If the train graph matrix is A, and the test graph matrix is B then we are simply constructing the block-wise matrix
where 0 is simply the all zero matrix (since there are no edges among the test samples). |
Beta Was this translation helpful? Give feedback.
-
can we only get a graph for the test data if we use |
Beta Was this translation helpful? Give feedback.
-
Unfortunately yes, that's the case right now.
Sorry.
…On Thu, May 16, 2024 at 6:42 PM Vishnu Muralidharan < ***@***.***> wrote:
can we only get a graph for the test data if we use transform_mode = graph
while fitting the model? I need the embeddings for train and test as well
as the graph for the test data. Kindly let me know how i can get both these.
—
Reply to this email directly, view it on GitHub
<#615 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC3IUBMTXDIKY622WQ6SJK3ZCUY5XAVCNFSM4ZCPWC52U5DIOJSWCZC7NNSXTOKENFZWG5LTONUW63SDN5WW2ZLOOQ5TSNBWGM2DIMI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I want to use UMap jointly with a classifier that needs a graph as input. It works well on training data, as it is straightforward to get the graph from the mapper. However, for test data, I only get the embedding of the points, not the graph. I have seen that you can select transform_mode = 'graph' to get a graph, but I do not understand what is the output graph on the test data, and how is it related to the graph computed on the train data.
I found the transform_mode by reading the code, but I can not find a documentation for that. It is currently not explained in the doc.
Is there a documentation that helps me to understand both what UMAP is exactly doing for generalization, and also how to get the graph it is already computing at generalization, so that I do not have to compute this graph by myself?
Ideally, I would like to obtain a graph that contains both training and testing data, but I am not sure if this is what the current code is doing.
Beta Was this translation helpful? Give feedback.
All reactions