umap icon indicating copy to clipboard operation
umap copied to clipboard

Get intermediate results at different epochs

Open matthieuheitz opened this issue 4 years ago • 3 comments

This is a proposition to be able to get intermediate results of the optimization, at different epochs. You just provide a list of int to n_epochs, and the result will be available after having called fit(), in the UMAP object as the member embedding_list.

Usage:

reducer = umap.UMAP(n_neighbors=n_neighbors, min_dist=min_dist, n_epochs=[100,200,300])
final = reducer.fit_transform(X)
embeddings = reducer.embedding_list  # List of size 3, containing embeddings at epoch=100, 200 and 300
# The last elements of `embeddings` is the same as `final`

For now, I've only implemented this for optimize_layout_euclidean. I'm waiting for your feedback on this one, and when it's good, I'll extend it to the other layout functions.

matthieuheitz avatar Jun 16 '21 19:06 matthieuheitz

Hello @matthieuheitz! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 2704:89: E501 line too long (92 > 88 characters) Line 2718:89: E501 line too long (91 > 88 characters)

Comment last updated at 2022-08-12 14:52:57 UTC

pep8speaks avatar Jun 16 '21 19:06 pep8speaks

This looks really promising and I'm sure it will be useful t many people, so thanks for submitting it. I left some comments mostly just around scikit-learn conventions which is is useful to try to hew to wherever possible as it results in least surprise for users.

lmcinnes avatar Jun 18 '21 16:06 lmcinnes

Sorry for being so slow to circle back to this. It looks good. I'll try to have a final review soon, and then hopefully just merge it. Thanks again for the contribution.

lmcinnes avatar Jun 06 '22 01:06 lmcinnes